PCATE_cfg: Configuration of Partial CATEs

PCATE_cfgR Documentation

Configuration of Partial CATEs

Description

[Experimental] 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.

Public fields

cfgs

Named list of covariates names to a Model_cfg object defining how to present that covariate's CATE surface.

model_covariates

A character vector of all the covariates to be included in the second-level effect regression.

num_mc_samples

A named list from covariate name to the number of Monte Carlo samples to take to calculate the double integral (See Details).

estimand

String indicating the estimand to target.

Methods

Public methods


Method new()

Create a new PCATE_cfg object with specified model name and hyperparameters.

Usage
PCATE_cfg$new(model_covariates, cfgs, num_mc_samples = 100)
Arguments
model_covariates

A character vector of all the covariates to be included in the second-level effect regression.

cfgs

Named list from moderator name to a Model_cfg object defining how to present that covariate's CATE surface.

num_mc_samples

A 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_cfg

A Model_cfg object indicating how to fit the second level effect regression (joint across all selected covariates).

Returns

A new PCATE_cfg object.

Examples
PCATE_cfg$new(
   cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
   model_covariates = c("x1", "x2", "x3"),
   num_mc_samples = list(x1 = 100)
)

Method 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.

Usage
PCATE_cfg$add_moderator(var_name, cfg)
Arguments
var_name

The name of the moderator to add (and the name of the column in the dataset).

cfg

A Model_cfg defining how to display the selected moderator's effect surface.

Returns

An updated PCATE_cfg object.

Examples
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))

Method clone()

The objects of this class are cloneable with this method.

Usage
PCATE_cfg$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

PCATE_cfg$new(
   cfgs = list(x1 = KernelSmooth_cfg$new(neval = 100)),
   model_covariates = c("x1", "x2", "x3"),
   num_mc_samples = list(x1 = 100)
)

## ------------------------------------------------
## 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)
)

## ------------------------------------------------
## 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))

tidyhte documentation built on Aug. 14, 2023, 5:08 p.m.