| setup_X1 | R Documentation |
Returns a list with three elements. The first element of the list, funs_Z, controls which functions of matrix Z are used as regressors in X_1. The second element, covariates, is an optional matrix of custom covariates that shall be included in X_1. The third element, fixed_effects, controls the inclusion of fixed effects.
setup_X1(funs_Z = c("B"), covariates = NULL, fixed_effects = NULL)
funs_Z |
Character vector controlling the functions of |
covariates |
Optional numeric matrix containing additional covariates to be included in X_1. Default is |
fixed_effects |
Numeric vector of integers that indicates cluster membership of the observations: For each cluster, a fixed effect will be added. Default is |
The output of this setup function is intended to be used as argument in the functions GenericML() and GenericML_single() (arguments X1_BLP, X1_GATES), as well as BLP() and GATES() (argument X1_control).
An object of class "setup_X1", consisting of the following components:
funs_ZA character vector, being a subset of c("S", "B", "p").
covariatesEither NULL or a numeric matrix.
fixed_effectsEither NULL or an integer vector indicating cluster membership.
See the description above for details.
Chernozhukov V., Demirer M., Duflo E., Fernández-Val I. (2020). “Generic Machine Learning Inference on Heterogenous Treatment Effects in Randomized Experiments.” arXiv preprint arXiv:1712.04802. URL: https://arxiv.org/abs/1712.04802.
GenericML(),
GenericML_single(),
BLP(),
GATES(),
setup_vcov(),
setup_diff()
set.seed(1)
n <- 100 # sample size
p <- 5 # number of covariates
covariates <- matrix(runif(n*p), n, p) # sample matrix of covariates
# let there be three clusters; assign membership randomly
fixed_effects <- sample(c(1,2,3), size = n, replace = TRUE)
# use BCA estimates in matrix X1
setup_X1(funs_Z = "B", covariates = NULL, fixed_effects = NULL)
# use BCA and propensity score estimates in matrix X1
# uses uniform covariates and fixed effects
setup_X1(funs_Z = c("B", "p"), covariates = covariates, fixed_effects = NULL)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.