tunevt: Fit a tuned Virtual Twins model

View source: R/main.R

tunevtR Documentation

Fit a tuned Virtual Twins model

Description

tunevt fits a Virtual Twins model to estimate factors and subgroups associated with differential treatment effects while controlling the Type I error rate of falsely detecting at least one heterogeneous effect when the treatment effect is uniform across the study population.

Usage

tunevt(
  data,
  Y = "Y",
  Trt = "Trt",
  step1 = "randomforest",
  step2 = "rtree",
  alpha0,
  p_reps,
  threshold = NA,
  keepz = FALSE,
  parallel = FALSE,
  ...
)

Arguments

data

a data frame containing a response, binary treatment indicators, and covariates.

Y

a string specifying the name of the column of data contains the response.

Trt

a string specifying the name of the column of data contains the treatment indicators.

step1

character strings specifying the Step 1 model. Supports either "lasso", "mars", "randomforest", or "superlearner".

step2

a character string specifying the Step 2 model. Supports "lasso", "rtree", "classtree", or "ctree".

alpha0

the nominal Type I error rate.

p_reps

the number of permutations to run.

threshold

for "step2 = 'classtree'" only. The value against which to test if the estimated individual treatment effect from Step 1 is higher (TRUE) or lower (FALSE).

keepz

logical. Should the estimated CATE from Step 1 be returned?

parallel

Should the loop over replications be parallelized? If FALSE, then no, if TRUE, then yes. Note that running in parallel requires a parallel backend that must be registered before performing the computation. See the foreach documentation for more details.

...

additional arguments to the Step 1 model call.

Details

Virtual Twins is a two-step approach to detecting differential treatment effects. Subjects' conditional average treatment effects (CATEs) are first estimated in Step 1 using a flexible model. Then, a simple and interpretable model is fit in Step 2 to model either (1) the expected value of these estimated CATEs if step2 is equal to "lasso", "rtree", or "ctree" or (2) the probability that the CATE is greater than a specified threshold if step2 is equal to "classtree".

The Step 2 model is dependent on some tuning parameter. This parameter is selected to control the Type I error rate by permuting the data under the null hypothesis of a constant treatment effect and identifying the minimal null penalty parameter (MNPP), which is the smallest penalty parameter that yields a Step 2 model with no covariate effects. The 1-alpha0 quantile of the distribution of is then used to fit the Step 2 model on the original data.

Value

An object of class "tunevt".

An object of class "tunevt" is a list containing at least the following components:

call

the matched call

vtmod

the model estimated by the given step2 procedure fit with the permuted tuning parameter for the estimated CATEs from the step1 model. See vt2_lasso, vt2_rtree, or vt2_ctree for specifics.

mnpp

the MNPP for the estimated CATEs from Step 1.

theta_null

a vector of the MNPPs from each permutation under the null hypothesis.

pvalue

the probability of observing a MNPP as or more extreme as the observed MNPP under the null hypothesis of no effect heterogeneity.

z

if keepz = TRUE, the estimated CATEs from the step1 model.

References

\insertRef

foster_subgroup_2011tehtuner

\insertRef

wolf_permutation_2022tehtuner

\insertRef

deng_practical_2023tehtuner

Examples

data(tehtuner_example)
# Low p_reps for example use only
tunevt(
  tehtuner_example, step1 = "lasso", step2 = "rtree",
  alpha0 = 0.2, p_reps = 5
)


tehtuner documentation built on April 3, 2023, 5:16 p.m.