FX.Predictor: Predictor class for the cross-fit predictor of "partial"...

FX.PredictorR Documentation

Predictor class for the cross-fit predictor of "partial" CATEs

Description

Predictor class for the cross-fit predictor of "partial" CATEs

Predictor class for the cross-fit predictor of "partial" CATEs

Details

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

Public fields

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

Methods

Public methods


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

Usage
FX.Predictor$new(models, num_splits, num_mc_samples, covariates, model_class)
Arguments
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).


Method predict()

Predicts the PCATE surface over a particular covariate, returning a tibble with the predicted HTE for every Monte-Carlo sample.

Usage
FX.Predictor$predict(data, covariate)
Arguments
data

The full dataset

covariate

The unquoted covariate name for which to calculate predicted treatment effects.

Returns

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


Method clone()

The objects of this class are cloneable with this method.

Usage
FX.Predictor$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


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