View source: R/counterfactual.R
counterfactual | R Documentation |
a function for computing the counterfactual distribution of outcomes that would occur if untreated individuals received their current outcome but the distribution of outcomes for treated individuals is replaced by the counterfactual distribution of outcomes that they would have if they had the same conditional distribution of outcomes untreated individuals but retain their same characteristics.
As an exammple, Callaway and Collins (2017) consider what a counterfactual economy with no unions in 1950 would look like. Here the counterfactual distribution of earnings combines the observed distribution of earnings for non-union individuals with a counterfactual distribution of earnings for union individuals. The latter counterfactual distribution replaces the conditional on covariates distribution of earnings for union individuals with the same one for non-union individuals, but holds constant the distribution of characteristics for union individuals. Here, characteristics are things like age and education.
counterfactual(outcome, wfun1, wfun2, data, tau = seq(0.1, 0.9, 0.1),
numyvals = NULL, se = TRUE, iters = 100, pl = FALSE, cores = 1)
outcome |
A vector of outcomes |
wfun1 |
A function that takes in 'data' and returns a vector of the same length as 'outcome' that contains the first set of weights |
wfun2 |
A function that takes in 'data' and returns a vector of the same length as 'outcome' that contains the first set of weights |
data |
A data.frame for which the functions wf1(data) and wf2(data) will be called |
tau |
The values at which to compute quantile effects, this should be a numeric vector with values strictly between 0 and 1 |
numyvals |
The number of values of the outcome to use in computing counterfactual distributions. The default is to use all of them; it may speed up computation to set this equal to some smaller number (e.g. 100) |
se |
whether or not to compute standard errors |
iters |
the number of bootstrap iterations to use to compute standard errors |
pl |
whether or not to bootstrap in parallel |
cores |
how many cores to uses when boostrapping in parallel |
QTE object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.