Calculate Variance-Covariance Matrix for a Fitted Model Object
Source:R/vcov.R
vcov.synthdid_estimate.RdProvides variance estimates based on the following three options
The bootstrap, Algorithm 2 in Arkhangelsky et al.
The jackknife, Algorithm 3 in Arkhangelsky et al.
Placebo, Algorithm 4 in Arkhangelsky et al.
Arguments
- object
A synthdid model
- method,
the CI method. The default is bootstrap (warning: this may be slow on large data sets, the jackknife option is the fastest, with the caveat that it is not recommended for SC).
- replications,
the number of bootstrap replications
- ...
Additional arguments (currently ignored).
Details
The jackknife is not recommended for SC, see section 5 in Arkhangelsky et al. "placebo" is the only option that works for only one treated unit.
References
Dmitry Arkhangelsky, Susan Athey, David A. Hirshberg, Guido W. Imbens, and Stefan Wager. "Synthetic Difference in Differences". arXiv preprint arXiv:1812.09970, 2019.
Examples
# \donttest{
# Compute variance using different methods
data(california_prop99)
setup <- panel.matrices(california_prop99)
tau.hat <- synthdid_estimate(setup$Y, setup$N0, setup$T0)
# Bootstrap standard error (default, may be slow)
se.bootstrap <- sqrt(vcov(tau.hat, method = "bootstrap", replications = 100))
# Jackknife standard error (faster)
se.jackknife <- sqrt(vcov(tau.hat, method = "jackknife"))
# Placebo standard error
se.placebo <- sqrt(vcov(tau.hat, method = "placebo", replications = 100))
# Display standard errors
c(bootstrap = se.bootstrap, jackknife = se.jackknife, placebo = se.placebo)
#> bootstrap jackknife placebo
#> NA NA 8.063535
# Or compute SE at estimation time
tau.hat.se <- synthdid_estimate(setup$Y, setup$N0, setup$T0,
estimate_se = TRUE, se_method = "jackknife"
)
#> Warning: jackknife standard errors require more than one treated unit and at least two controls with weight.
# Reuses cached SE without recomputation
se.cached <- sqrt(vcov(tau.hat.se, method = "jackknife"))
# }