xsdid_se_bootstrap | R Documentation |
Each clustered bootstrap sample is a sample of units with replacement. It is guranteed that at least 2 treatment group and at least 2 control group units are selected. (Ideally at least 1 of each should suffice but just a single observation in a group can lead to downstream errors when calling synthdid_estimate. This issue needs to be explored further)
xsdid_se_bootstrap( panel, unit = 1, time = 2, outcome = 3, treatment = 4, x, B = 100, num.cores = 1 )
panel |
A data frame with columns consisting of units, time, outcome, and treatment indicator. It should be a balanced panel and not contain any NA. |
unit |
The column number/name corresponding to the unit identifier. Default is 1. |
time |
The column number/name corresponding to the time identifier. Default is 2. |
outcome |
The column number/name corresponding to the outcome identifier. Default is 3. |
treatment |
The column number/name corresponding to the treatment status. Default is 4. |
x |
The column numbers/names of all additional control variables |
B |
number of bootstrap samples (Default 100). |
num.cores |
if larger than 1 use the parallel package to perform the bootstrap estimation on multiple cores. (More than 1 core does not work on Windows.) |
In each bootstrap sample, we use the function adjust.outcome.for.x to adjust for the covariates.
As list with 2 elements: - se is the estimated standard error of the treatment effect tau. - boot.tau is a vector containing the estimated treatment effects tau for each bootstrap replication.
## Not run: dat = xsdid.mc(N=20, T=20,return.data = TRUE) xsdid_estimate(dat, unit="i",time = "t",outcome = "y",treatment = "treat_exp",x = "x") xsdid_se_bootstrap(dat, unit="i",time = "t",outcome = "y",treatment = "treat_exp",x = "x", B=100)$se ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.