PCATE_cfg is a configuration class for estimating marginal
response surfaces based on heterogeneous treatment effect estimates.
"Partial" in this context is used similarly to the use in partial
dependence plots or in partial regression. In essence, a PCATE
attempts to partial out the contribution to the CATE from all other
covariates. Two highly correlated variables may have very different
PCATE surfaces.
cfgsNamed list of covariates names to a Model_cfg object defining
how to present that covariate's CATE surface.
model_covariatesA character vector of all the covariates to be included in the second-level effect regression.
num_mc_samplesA named list from covariate name to the number of Monte Carlo samples to take to calculate the double integral (See Details).
estimandString indicating the estimand to target.
new()Create a new PCATE_cfg object with specified model name and hyperparameters.
PCATE_cfg$new(model_covariates, cfgs, num_mc_samples = 100)model_covariatesA character vector of all the covariates to be included in the second-level effect regression.
cfgsNamed list from moderator name to a Model_cfg object defining how to
present that covariate's CATE surface.
num_mc_samplesA named list from covariate name to the number of Monte Carlo samples to take to calculate the double integral (See Details). If all covariates should use the same number of samples, simply pass the (integer) number of samples.
effect_cfgA Model_cfg object indicating how to fit the second level effect
regression (joint across all selected covariates).
PCATE_cfg$new(
cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
model_covariates = c("x1", "x2", "x3"),
num_mc_samples = list(x1 = 100)
)add_moderator()Add a moderator to the PCATE_cfg object. This entails adding it to the joint
model of effects and defines a configuration for displaying the effect surface
for that moderator.
var_nameThe name of the moderator to add (and the name of the column in the dataset).
cfgA Model_cfg defining how to display the selected moderator's effect
surface.
cfg <- PCATE_cfg$new(
cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
model_covariates = c("x1", "x2", "x3"),
num_mc_samples = list(x1 = 100)
)
cfg <- cfg$add_moderator("x2", KernelSmooth_cfg$new(neval = 100))PCATE_cfg$new(
cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
model_covariates = c("x1", "x2", "x3"),
num_mc_samples = list(x1 = 100)
)
#> <PCATE_cfg>
#> Public:
#> add_moderator: function (var_name, cfg)
#> cfgs: list
#> clone: function (deep = FALSE)
#> estimand: PCATE
#> initialize: function (model_covariates, cfgs, num_mc_samples = 100)
#> model_covariates: x1 x2 x3
#> num_mc_samples: list
## ------------------------------------------------
## Method `PCATE_cfg$new`
## ------------------------------------------------
PCATE_cfg$new(
cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
model_covariates = c("x1", "x2", "x3"),
num_mc_samples = list(x1 = 100)
)
#> <PCATE_cfg>
#> Public:
#> add_moderator: function (var_name, cfg)
#> cfgs: list
#> clone: function (deep = FALSE)
#> estimand: PCATE
#> initialize: function (model_covariates, cfgs, num_mc_samples = 100)
#> model_covariates: x1 x2 x3
#> num_mc_samples: list
## ------------------------------------------------
## Method `PCATE_cfg$add_moderator`
## ------------------------------------------------
cfg <- PCATE_cfg$new(
cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
model_covariates = c("x1", "x2", "x3"),
num_mc_samples = list(x1 = 100)
)
cfg <- cfg$add_moderator("x2", KernelSmooth_cfg$new(neval = 100))