View source: R/multisynth_class.R
multisynth | R Documentation |
Fit staggered synth
multisynth(
form,
unit,
time,
data,
n_leads = NULL,
n_lags = NULL,
nu = NULL,
lambda = 0,
V = NULL,
fixedeff = TRUE,
n_factors = 0,
scm = T,
time_cohort = F,
how_match = "knn",
cov_agg = NULL,
eps_abs = 1e-04,
eps_rel = 1e-04,
verbose = FALSE,
...
)
form |
outcome ~ treatment | weighting covariates | approximate matching covaraites | exact matching covariates
If covariates are time-varying, their average value before the first unit is treated will be used. This can be changed by supplying a custom aggregation function to cov_agg. |
unit |
Name of unit column |
time |
Name of time column |
data |
Panel data as dataframe |
n_leads |
How long past treatment effects should be estimated for, default is number of post treatment periods for last treated unit |
n_lags |
Number of pre-treatment periods to balance, default is to balance all periods |
nu |
Fraction of balance for individual balance |
lambda |
Regularization hyperparameter, default = 0 |
V |
Scaling matrix for synth optimization, default NULL is identity |
fixedeff |
Whether to include a unit fixed effect, default TRUE |
n_factors |
Number of factors for interactive fixed effects, setting to NULL fits with CV, default is 0 |
scm |
Whether to fit scm weights |
time_cohort |
Whether to average synthetic controls into time cohorts, default FALSE |
cov_agg |
Covariate aggregation function |
eps_abs |
Absolute error tolerance for osqp |
eps_rel |
Relative error tolerance for osqp |
verbose |
Whether to print logs for osqp |
... |
Extra arguments |
multisynth object that contains:
"weights"weights matrix where each column is a set of weights for a treated unit
"data"Panel data as matrices
"imbalance"Matrix of treatment minus synthetic control for pre-treatment time periods, each column corresponds to a treated unit
"global_l2"L2 imbalance for the pooled synthetic control
"scaled_global_l2"L2 imbalance for the pooled synthetic control, scaled by the imbalance for unitform weights
"ind_l2"Average L2 imbalance for the individual synthetic controls
"scaled_ind_l2"Average L2 imbalance for the individual synthetic controls, scaled by the imbalance for unitform weights
"n_leads", "n_lags"Number of post treatment outcomes (leads) and pre-treatment outcomes (lags) to include in the analysis
"nu"Fraction of balance for individual balance
"lambda"Regularization hyperparameter
"scm"Whether to fit scm weights
"grps"Time periods for treated units
"y0hat"Pilot estimates of control outcomes
"residuals"Difference between the observed outcomes and the pilot estimates
"n_factors"Number of factors for interactive fixed effects
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.