Description Usage Arguments Value References Examples
Function that calculates propensity scores with an option to check calibration and overlap assumptions
1 2 3 4 5 6 7 8 9 10 11 |
data |
a dataframe object containing the variables and values. |
x |
a list of character vectors specifying variables to be included in the model (columns in the data). If unspecified, then it is assumed to be all columns in the data besides y and w. |
y |
a character vector specifying the response variable. |
w |
a character vector specifying the treatment variable. Treatment must be specified as 0 and 1 or TRUE and FALSE. |
subset |
an optional vector specifying a subset of observations to be used in the fitting process. |
model |
a character string naming the model used (one of "logistic", "lasso", or "causal forest"). |
trim |
a list of two numeric elements describing cutoffs at which to trim propensity scores. |
plot |
logical; if TRUE then produces histogram of propensity scores to check that the overlap assumption is satisfied and a Q-Q plot to check the calibration. |
... |
additional arguments to be passed to the model fitting functions. |
a vector of propensity scores where the indices of the vector correspond to the indices in data
.
Imbens, Guido, and Donald Rubin. Causal Inference for Statistics, Social, and Biomedical Sciences: An Introduction. Cambridge University Press, 2015.
1 2 3 4 | data(lalonde)
logit_propensities <- propensity_score(lalonde, y = "re78", w = "treat", model = "logistic")
lasso_propensities <- propensity_score(lalonde, y = "re78", w = "treat", model = "lasso")
cf_propensities <- propensity_score(lalonde, y = "re78", w = "treat", model = "causal forest")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.