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.
tunevt(
data,
Y = "Y",
Trt = "Trt",
step1 = "randomforest",
step2 = "rtree",
alpha0,
p_reps,
threshold = NA,
keepz = FALSE,
parallel = FALSE,
...
)An object of class "tunevt".
An object of class "tunevt" is a list containing at least the
following components:
the matched call
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.
the MNPP for the estimated CATEs from Step 1.
a vector of the MNPPs from each permutation under the null hypothesis.
the probability of observing a MNPP as or more extreme as the observed MNPP under the null hypothesis of no effect heterogeneity.
if keepz = TRUE, the estimated CATEs from the
step1 model.
a data frame containing a response, binary treatment indicators, and covariates.
a string specifying the name of the column of data
contains the response.
a string specifying the name of the column of data
contains the treatment indicators.
character strings specifying the Step 1 model. Supports
either "lasso", "mars", "randomforest", or
"superlearner".
a character string specifying the Step 2 model. Supports
"lasso", "rtree", "classtree", or "ctree".
the nominal Type I error rate.
the number of permutations to run.
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).
logical. Should the estimated CATE from Step 1 be returned?
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.
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.
foster_subgroup_2011tehtunerwolf_permutation_2022tehtunerdeng_practical_2023tehtuner
data(tehtuner_example)
# Low p_reps for example use only
tunevt(
tehtuner_example, step1 = "lasso", step2 = "rtree",
alpha0 = 0.2, p_reps = 5
)
Run the code above in your browser using DataLab