| scm_fit | R Documentation |
Unified formula interface for Synthetic Control and related causal inference methods. The formula syntax is:
scm_fit(
formula,
data,
method = c("scm", "sdid", "gsc", "mc", "tasc", "si"),
...,
predictors = NULL,
covariates = NULL,
v_selection = c("insample", "oos"),
donor_mspe_threshold = Inf,
lambda_pen = NULL,
v_optim = c("auto", "coord_descent", "bfgs", "multistart"),
qp_solver = c("auto", "active_set", "wolfe"),
v_window = NULL,
nu = NULL,
fixedeff = NULL,
pool_cohorts = TRUE,
weights = NULL
)
formula |
A |
data |
A |
method |
One of |
... |
Estimator-specific arguments forwarded to the chosen method:
Three tuning parameters that govern model complexity are selected from
the data when left at their |
predictors |
A |
covariates |
An optional named |
v_selection |
V matrix selection method for |
donor_mspe_threshold |
Donor pool filtering threshold (Abadie 2021 S.4).
For |
lambda_pen |
Penalised SCM parameter (Abadie & L'Hour 2021, JASA).
For |
v_optim |
Outer V-optimisation method for |
qp_solver |
Inner-QP solver for |
v_window |
Optional vector of pre-treatment time values (matching the
time index in |
nu |
How strongly the adoption cohorts are pooled in staggered
SCM fits (Ben-Michael, Feller & Rothstein 2022, JRSS-B). Cohort weight
vectors are chosen jointly to minimise
Staggered panels only. Under a single adoption date there are no cohorts to pool across, and several units sharing one date are already fully pooled into that cohort: S.4.1 of the paper shows the across-unit variation that would justify doing otherwise is zero when the adoption date is shared. |
fixedeff |
Unpenalised additive level terms. For |
pool_cohorts |
For staggered |
weights |
Optional named numeric vector over the treated units giving
the mass each carries in the aggregate ATT, for |
outcome ~ treatment | unit_id + time_id
An object of classes c("coresynth_<method>", "coresynth").
Fits with staggered adoption additionally inherit from
"coresynth_staggered", and multi-arm SI fits from
"coresynth_multiarm"; S3 methods such as tidy() and augment()
dispatch on these subclasses.
All methods return at minimum:
method: estimator name
estimate: average treatment effect (ATT)
times: time index vector
T_pre: number of pre-treatment periods
Y_treat: treated unit outcome series
gap: treatment effect series (Y_treat - counterfactual)
Staggered method = "scm" fits add cohort_estimates, cohort_fits,
and the settings the fit resolved: nu (the number the partially pooled
solver used, or "separate" for the per-cohort path), fixedeff,
pool_cohorts and qp_solver.
# Synthetic balanced panel: 10 units over 20 periods, unit 1 treated
# after period 15.
set.seed(1)
panel <- expand.grid(unit = 1:10, year = 1:20)
panel$treated <- as.integer(panel$unit == 1 & panel$year > 15)
panel$gdp <- panel$unit + 0.5 * panel$year +
rnorm(nrow(panel)) + 3 * panel$treated
fit <- scm_fit(gdp ~ treated | unit + year, data = panel, method = "sdid")
summary(fit)
# Visualise the estimated gap (requires ggplot2)
plot(fit, type = "gap")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.