Estimation API

Tidy functions for performing an analysis of heterogeneous treatment effects. Once a configuration has been defined (like by the Recipe API), these functions are the workhorses that perform all estimation.

attach_config()

Attach an HTE_cfg to a dataframe

make_splits()

Define splits for cross-fitting

produce_plugin_estimates()

Estimate models of nuisance functions

construct_pseudo_outcomes()

Construct Pseudo-outcomes

estimate_QoI()

Estimate Quantities of Interest

Recipe API

Tidy functions for configuring a “recipe” for how to estimate heterogeneous treatment effects. This is the easiest way to get started with setting up a configuration for an HTE analysis.

basic_config()

Create a basic config for HTE estimation

add_propensity_score_model()

Add an additional model to the propensity score ensemble

add_known_propensity_score()

Uses a known propensity score

add_propensity_diagnostic()

Add an additional diagnostic to the propensity score

add_outcome_model()

Add an additional model to the outcome ensemble

add_outcome_diagnostic()

Add an additional diagnostic to the outcome model

add_effect_model()

Add an additional model to the joint effect ensemble

add_effect_diagnostic()

Add an additional diagnostic to the effect model

add_moderator()

Adds moderators to the configuration

add_vimp()

Adds variable importance information

remove_vimp()

Removes variable importance information

Model Configuration

Classes to define the configuration of models to be used in the eventual HTE analysis. These are the classes which define the underlying configurations in the Recipe API. They’re most useful for advanced users who want the most granular control over their analysis, but most users will be best served by the Recipe API.

Base Class

Model_cfg

Base Class of Model Configurations

Models for displaying results

These model configurations include valid standard errors and are well suited for providing usable output to be plotted or returned for formal inference.

Stratified_cfg

Configuration for a Stratification Estimator

KernelSmooth_cfg

Configuration for a Kernel Smoother

Models for nuisance functions

These models are most useful for estimating nuisance functions in the course of HTE estimation. In particular, Known_cfg may be used when the propensity score is known ex ante, while SLEnsemble_cfg may be used when a SuperLearner ensemble of machine learning models should be used to estimate an unknown nuisance function.

Known_cfg

Configuration of Known Model

Constant_cfg

Configuration of a Constant Estimator

SLEnsemble_cfg

Configuration for a SuperLearner Ensemble

SLLearner_cfg

Configuration of SuperLearner Submodel

Analysis Configuration

These classes configure the overall shape of the HTE analysis: essentially, how all the various components and models should fit together. They explain what models should be estimated and how those models should be combined into relevant quantities of interest. These, too, underlie the Recipe API, and should rarely need to be used directly.

Diagnostics_cfg

Configuration of Model Diagnostics

HTE_cfg

Configuration of Quantities of Interest

QoI_cfg

Configuration of Quantities of Interest

VIMP_cfg

Configuration of Variable Importance

Configuration of HTE estimands

There are two configurations for HTE estimands. MCATE_cfg simply provides a one-dimensional slice of the effects over a particular dimension. It averages over all other moderators, so does not attempt to attribute heterogeneity to particular covariates. PCATE_cfg, however, does attempt to do this type of attribution. Estimation of these “partial” effects requires strong assumptions, even within the context of a randomized control trial. Essentially, one must assume that the moderator, too, is random conditional on treatment and other covariates.

MCATE_cfg

Configuration of Marginal CATEs

PCATE_cfg

Configuration of Partial CATEs

Internal Functions

The remaining functions are not really useful for end-users. Documentation is provided in order to provide additional details about the internal workings of the methods.

SL.glmnet.interaction()

Elastic net regression with pairwise interactions

predict(<SL.glmnet.interaction>)

Prediction for an SL.glmnet object

calculate_ate()

Calculates a SATE and a PATE using AIPW

calculate_diagnostics()

Calculate diagnostics

calculate_rroc()

Regression ROC Curve calculation

calculate_linear_vimp()

Calculate Linear Variable Importance of HTEs

calculate_vimp()

Calculate Variable Importance of HTEs

split_data()

Partition the data into folds

Model_data

R6 class to represent data to be used in estimating a model

check_data_has_hte_cfg()

Checks that a dataframe has an attached configuration for HTEs

check_identifier()

Checks that an appropriate identifier has been provided

check_nuisance_models()

Checks that nuisance models have been estimated and exist in the supplied dataset.

check_splits()

Checks that splits have been properly created.

check_weights()

Checks that an appropriate weighting variable has been provided

fit_plugin()

Fits a plugin model using the appropriate settings

fit_plugin_A()

Fits a propensity score model using the appropriate settings

fit_plugin_Y()

Fits a T-learner using the appropriate settings

fit_effect()

Fits a treatment effect model using the appropriate settings

listwise_deletion()

Removes rows which have missing data on any of the supplied columns.