mscmt {MSCMT} | R Documentation |
Multivariate SCM Using Time Series
Description
mscmt
performs the Multivariate Synthetic Control Method Using Time
Series.
Usage
mscmt(
data,
treatment.identifier = NULL,
controls.identifier = NULL,
times.dep = NULL,
times.pred = NULL,
agg.fns = NULL,
placebo = FALSE,
placebo.with.treated = FALSE,
univariate = FALSE,
univariate.with.dependent = FALSE,
check.global = TRUE,
inner.optim = "wnnlsOpt",
inner.opar = list(),
outer.optim = "DEoptC",
outer.par = list(),
outer.opar = list(),
std.v = c("sum", "mean", "min", "max"),
alpha = NULL,
beta = NULL,
gamma = NULL,
return.ts = TRUE,
single.v = FALSE,
verbose = TRUE,
debug = FALSE,
seed = NULL,
cl = NULL,
times.pred.training = NULL,
times.dep.validation = NULL,
v.special = integer(),
cv.alpha = 0,
spec.search.treated = FALSE,
spec.search.placebos = FALSE
)
Arguments
data |
Typically, a list of matrices with rows corresponding to times
and columns corresponding to units for all relevant features (dependent as
well as predictor variables, identified by the list elements' names).
This might be the result of converting from a
For convenience, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
treatment.identifier |
A character scalar containing the name of the
treated unit.
Must be contained in the column names of the matrices in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
controls.identifier |
A character vector containing the names of at
least two control units.
Entries must be contained in the column names of the matrices in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
times.dep |
A matrix with two rows (containing start times in the first and end times in the second row) and one column for each dependent variable, where the column names must exactly match the names of the corresponding dependent variables. A sequence of dates with the given start and end times of
will be constructed; these dates are looked for in the row names of
the respective matrices in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
times.pred |
A matrix with two rows (containing start times in the first and end times in the second row) and one column for each predictor variable, where the column names must exactly match the names of the corresponding predictor variables. A sequence of dates with the given start and end times of
will be constructed; these dates are looked for in the row names of
the respective matrices in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
agg.fns |
Either | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placebo |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
placebo.with.treated |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
univariate |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
univariate.with.dependent |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
check.global |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inner.optim |
A character scalar containing the name of the optimization
method for the inner optimization. Defaults to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
inner.opar |
A list containing further parameters for the inner
optimizer. Defaults to the empty list. (For | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
outer.optim |
A character vector containing the name(s) of the
optimization method(s) for the outer optimization. Defaults to
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
outer.par |
A list containing further parameters for the outer optimization procedure. Defaults to the empty list. Entries in this list may override the following hard-coded general defaults:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
outer.opar |
A list (or a list of lists, if
If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std.v |
A character scalar containing one of the function names
"sum", "mean", "min", or "max" for the standardization of the predictor
weights (weights are divided by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
alpha |
A numerical vector with weights for the dependent variables
in an MSCMT optimization or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
beta |
Either
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gamma |
Either
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return.ts |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
single.v |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
verbose |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
debug |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
seed |
A numerical vector or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cl |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
times.pred.training |
A matrix with two rows (containing start times in
the first and end times in the second row) and one column for each predictor
variable, where the column names must exactly match the names of the
corresponding predictor variables (or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
times.dep.validation |
A matrix with two rows (containing start times in
the first and end times in the second row) and one column for each dependent
variable, where the column names must exactly match the names of the
corresponding dependent variables (or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
v.special |
integer vector containing indices of important predictors with special treatment (see below). Defaults to the empty set. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cv.alpha |
numeric scalar containing the minimal proportion (of the
maximal feasible weight) for the weights of the predictors selected by
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spec.search.treated |
A logical scalar. If | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
spec.search.placebos |
A logical scalar. If |
Details
mscmt
combines, if necessary, the preparation of the raw data (which
is expected to be in "list" format, possibly after conversion from a
data.frame
with function listFromLong
) and the call to the appropriate
MSCMT optimization procedures (depending on the input parameters).
For details on the input parameters alpha
, beta
, and
gamma
, see [1]. For details on cross-validation, see [2].
Value
An object of class "mscmt"
, which is essentially a list
containing the results of the estimation and, if applicable, the placebo
study.
The most important list elements are
the weight vector
w
for the control units,a matrix
v
with weight vectors for the predictors in its columns,scalars
loss.v
andrmspe
with the dependent loss and its square root,a vector
loss.w
with the predictor losses corresponding to the various weight vectors in the columns ofv
,a matrix
predictor.table
containing aggregated statistics of predictor values (similar to list elementtab.pred
of functionsynth.tab
of package'Synth'
),a list of multivariate time series
combined
containing, for each dependent and predictor variable, a multivariate time series with elementstreated
for the actual values of the treated unit,synth
for the synthesized values, andgaps
for the differences.
Placebo studies produce a list containing individual results for each
unit (as treated unit), starting with the original treated unit, as well
as a list element named placebo
with aggregated results for each
dependent and predictor variable.
If times.pred.training
and times.dep.validation
are not
NULL
, a cross-validation is done and a list of elements cv
with the results of the cross-validation period and main
with
the results of the main period is returned.
References
[1] Becker M, Klößner S (2018). “Fast and Reliable Computation of Generalized Synthetic Controls.” Econometrics and Statistics, 5, 1–19. https://doi.org/10.1016/j.ecosta.2017.08.002.
[2] Becker M, Klößner S, Pfeifer G (2018). “Cross-Validating Synthetic Controls.” Economics Bulletin, 38, 603-609. Working Paper, http://www.accessecon.com/Pubs/EB/2018/Volume38/EB-18-V38-I1-P58.pdf.
Examples
## Not run:
## for examples, see the package vignettes:
browseVignettes(package="MSCMT")
## End(Not run)