RCTREP {RCTrep} | R Documentation |
Replicate treatment effect estimates obtained from a randomized control trial using observational data
Description
The function RCTREP
is used to validate the estimates of treatment effects obtained from observational data by comparing to estimates from a target randomized control trial. The function currently implements the following types of estimators of treatment effects: G_computation, inverse propensity score weighting (IPW), and augmented propensity score weighting. The function implements the following three types of weighting estimators to compare the resulting estimates of treatment effects from RWD to the target RCT: exact matching weights, inverse selection probability weighting, and sub-classification. Since we regard the sample in the RCT as the target population, weights for each individual in observational data is p/(1-p)
so that the weighted population of observational data is representative to the target population.
Usage
RCTREP(
TEstimator = "G_computation",
SEstimator = "Exact",
source.data = source.data,
target.data = target.data,
source.name = "RWD",
target.name = "RCT",
vars_name,
selection_predictors,
outcome_method = "glm",
treatment_method = "glm",
weighting_method = "glm",
outcome_formula = NULL,
treatment_formula = NULL,
selection_formula = NULL,
stratification = NULL,
stratification_joint = FALSE,
strata_cut_source = NULL,
strata_cut_target = NULL,
two_models = FALSE,
data.public = TRUE,
...
)
Arguments
TEstimator |
A character specifying an estimator for conditional average treatment effects. The allowed estimators for |
SEstimator |
A character specifying an estimator for weight. The allowed estimators are: |
source.data |
A data frame containing variables named in |
target.data |
A data frame containing variables named in |
source.name |
A character indicating the name of |
target.name |
A character indicating the name of |
vars_name |
A list containing four vectors |
selection_predictors |
a character vector specifying variable names. The weights are estimated based on the variables. |
outcome_method , treatment_method , weighting_method |
A character specifying model for outcome, treatment, and weight to use. Possible values are found using |
outcome_formula , treatment_formula , selection_formula |
An optional object of class |
stratification |
An optional character vector containing variables to select subgroups. |
stratification_joint |
An optional logical indicating if the subgroups are selected based on levels of combined variables in |
strata_cut_source |
An optional list containing lists. Each component is a list with tag named by a variable in |
strata_cut_target |
An optional list containing lists. Each component is a list with tag named by a variable in |
two_models |
An optional logical indicating whether potential outcomes should be modeled separately when |
data.public |
An optional logical indicating whether the |
... |
An optional argument passed to |
Details
An R6 object is constructed by a wrapper function TEstimator_wrapper
and SEstimator_wrapper
with user's input of data and estimators for treatment effect and weight. TEstimator_wrapper()
returns initialized objects source.obj
and target.obj
. SEstimator_wrapper()
weights the estimates of source.obj
via the class method RCTrep()
. The weights are computed using data in the source object source.obj
, target object target.obj
, and estimator of weights SEstimator
.
Value
A list of length three with three R6 class objects, source.obj
, target.obj
and source.rep.obj
Examples
output <- RCTREP(TEstimator = "G_computation", SEstimator = "Exact",
outcome_method = "BART",
source.data = RCTrep::source.data[sample(dim(RCTrep::source.data)[1],500),],
target.data = RCTrep::target.data[sample(dim(RCTrep::target.data)[1],500),],
vars_name = list(outcome_predictors =
c("x1","x2","x3","x4","x5","x6"),
treatment_name = c('z'),
outcome_name = c('y')),
selection_predictors = c("x2","x6"),
stratification = c("x1","x3","x4","x5"),
stratification_joint = TRUE)
output$target.obj
output$source.obj
output$source.rep.obj