xsdid_se_bootstrap: Compute bootstrap standard errors for SDID with time varying...

xsdid_se_bootstrapR Documentation

Compute bootstrap standard errors for SDID with time varying covariates

Description

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)

Usage

xsdid_se_bootstrap(
  panel,
  unit = 1,
  time = 2,
  outcome = 3,
  treatment = 4,
  x,
  B = 100,
  num.cores = 1
)

Arguments

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.)

Details

In each bootstrap sample, we use the function adjust.outcome.for.x to adjust for the covariates.

Value

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.

Examples

## 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)

skranz/xsynthdid documentation built on May 23, 2022, 8:50 p.m.