FX.Predictor | R Documentation |
Predictor class for the cross-fit predictor of "partial" CATEs
Predictor class for the cross-fit predictor of "partial" CATEs
The class makes it easier to manage the K predictors for retrieving K-fold cross-validated estimates, as well as to measure how treatment effects change when only a single covariate is changed from its "natural" levels (in the sense "natural" used by the direct / indirect effects literature).
models
A list of the K model fits
num_splits
The number of folds used in cross-fitting.
num_mc_samples
The number of samples to retrieve across the covariate space. If num_mc_samples is larger than the sample size, then the entire dataset will be used.
covariates
The unquoted names of the covariates used in the second-stage model.
model_class
The model class (in the sense of Model_cfg
). For instance,
a SuperLearner model will have model class "SL".
new()
FX.predictor
is a class which simplifies the management of a set of cross-fit
prediction models of treatment effects and provides the ability to get the "partial"
effects of particular covariates.
FX.Predictor$new(models, num_splits, num_mc_samples, covariates, model_class)
models
A list of the K model fits.
num_splits
Integer number of cross-fitting folds.
num_mc_samples
Integer number of Monte-Carlo samples across the covariate space. If this is larger than the sample size, then the whole dataset will be used.
covariates
The unquoted names of the covariates.
model_class
The model class (in the sense of Model_cfg
).
predict()
Predicts the PCATE surface over a particular covariate, returning a tibble with the predicted HTE for every Monte-Carlo sample.
FX.Predictor$predict(data, covariate)
data
The full dataset
covariate
The unquoted covariate name for which to calculate predicted treatment effects.
A tibble with columns:
covariate_value
- The value of the covariate of interest
.hte
- An estimated HTE
.id
- The identifier for the original row (which had
covariate
modified to covariate_value
).
clone()
The objects of this class are cloneable with this method.
FX.Predictor$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.