Title: | Prediction Intervals for Synthetic Control Methods with Multiple Treated Units and Staggered Adoption |
---|---|
Description: | Implementation of prediction and inference procedures for Synthetic Control methods using least square, lasso, ridge, or simplex-type constraints. Uncertainty is quantified with prediction intervals as developed in Cattaneo, Feng, and Titiunik (2021) <https://nppackages.github.io/references/Cattaneo-Feng-Titiunik_2021_JASA.pdf> for a single treated unit and in Cattaneo, Feng, Palomba, and Titiunik (2023) <doi:10.48550/arXiv.2210.05026> for multiple treated units and staggered adoption. More details about the software implementation can be found in Cattaneo, Feng, Palomba, and Titiunik (2024) <doi:10.48550/arXiv.2202.05984>. |
Authors: | Matias Cattaneo [aut], Yingjie Feng [aut], Filippo Palomba [aut, cre], Rocio Titiunik [aut] |
Maintainer: | Filippo Palomba <[email protected]> |
License: | GPL-2 |
Version: | 3.0.0 |
Built: | 2025-03-02 06:20:40 UTC |
Source: | https://github.com/cran/scpi |
scpi
: A Package to Compute Synthetic Control Prediction Intervals With Multiple Treated Units and Staggered AdoptionThe package implements estimation, inference procedures, and produces plots for Synthetic Control (SC) methods using least squares, lasso, ridge, or simplex-type constraints. Uncertainty is quantified using prediction intervals according to Cattaneo, Feng, and Titiunik (2021).
Included functions are: scdata and scdataMulti for data preparation, scest for point estimation, scpi for inference procedures, and scplot and scplotMulti for plots.
print()
and summary()
methods are available for scest
and scpi
.
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
Useful links:
The coef method for synthetic control prediction fitted objects.
## S3 method for class 'scest' coef(object, ...)
## S3 method for class 'scest' coef(object, ...)
object |
Class "scest" object, obtained by calling |
... |
Other arguments (eg. |
No return value, called to show scest
constructed weights.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
scest
for synthetic control prediction.
Supported methods: print.scest
, summary.scest
, coef.scest
.
The coef method for synthetic control prediction fitted objects.
## S3 method for class 'scpi' coef(object, ...)
## S3 method for class 'scpi' coef(object, ...)
object |
Class "scpi" object, obtained by calling |
... |
Other arguments (eg. |
No return value, called to show scpi
constructed weights.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
scpi
for synthetic control prediction.
Supported methods: print.scpi
, summary.scpi
, coef.scpi
.
The print method for synthetic control data objects.
## S3 method for class 'scdata' print(x, ...)
## S3 method for class 'scdata' print(x, ...)
x |
Class "scdata" object, obtained by calling |
... |
Other arguments. |
No return value, called to print scdata
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
scdata
for synthetic control data preparation.
Supported methods: print.scdata
, summary.scdata
.
The print method for synthetic control data objects.
## S3 method for class 'scdataMulti' print(x, ...)
## S3 method for class 'scdataMulti' print(x, ...)
x |
Class "scdataMulti" object, obtained by calling |
... |
Other arguments. |
No return value, called to print scdataMulti
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
scdataMulti
for synthetic control data preparation.
Supported methods: print.scdataMulti
, summary.scdataMulti
.
The print method for synthetic control prediction fitted objects.
## S3 method for class 'scest' print(x, ...)
## S3 method for class 'scest' print(x, ...)
x |
Class "scest" object, obtained by calling |
... |
Other arguments. |
No return value, called to print scest
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
scest
for synthetic control prediction.
Supported methods: print.scest
, summary.scest
, coef.scest
.
The print method for synthetic control inference objects.
## S3 method for class 'scpi' print(x, ...)
## S3 method for class 'scpi' print(x, ...)
x |
Class "scpi" object, obtained by calling |
... |
Other arguments. |
No return value, called to print scpi
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
scpi
for synthetic control inference
Supported methods: print.scpi
, summary.scpi
.
scest
or scpi
for Point Estimation and Inference Procedures Using Synthetic Control Methods.The command prepares the data to be used by scest
or scpi
to implement estimation and
inference procedures for Synthetic Control (SC) methods.
It allows the user to specify the outcome variable, the features of the treated unit to be
matched, and covariate-adjustment feature by feature. The names of the output matrices
follow the terminology proposed in Cattaneo, Feng, and Titiunik (2021).
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdataMulti for data preparation in the multiple treated units case with staggered adoption, scest for point estimation, scpi for inference procedures, scplot and scplotMulti for plots in the single and multiple treated unit(s) cases, respectively.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
scdata( df, id.var, time.var, outcome.var, period.pre, period.post, unit.tr, unit.co, features = NULL, cov.adj = NULL, cointegrated.data = FALSE, anticipation = 0, constant = FALSE, verbose = TRUE )
scdata( df, id.var, time.var, outcome.var, period.pre, period.post, unit.tr, unit.co, features = NULL, cov.adj = NULL, cointegrated.data = FALSE, anticipation = 0, constant = FALSE, verbose = TRUE )
df |
a dataframe object. |
id.var |
a character or numeric scalar with the name of the variable containing units' IDs. The ID variable can be numeric or character. |
time.var |
a character with the name of the time variable. The time variable has to be numeric, integer, or Date. In
case |
outcome.var |
a character with the name of the outcome variable. The outcome variable has to be numeric. |
period.pre |
a numeric vector that identifies the pre-treatment period in time.var. |
period.post |
a numeric vector that identifies the post-treatment period in time.var. |
unit.tr |
a character or numeric scalar that identifies the treated unit in |
unit.co |
a character or numeric vector that identifies the donor pool in |
features |
a character vector containing the name of the feature variables used for estimation.
If this option is not specified the default is |
cov.adj |
a list specifying the names of the covariates to be used for adjustment for each feature. If |
cointegrated.data |
a logical that indicates if there is a belief that the data is cointegrated or not.
The default value is |
anticipation |
a scalar that indicates the number of periods of potential anticipation effects. Default is 0. |
constant |
a logical which controls the inclusion of a constant term across features. The default value is |
verbose |
if |
cov.adj
can be used in two ways. First, if only one feature is specified through the option features
,
cov.adj
has to be a list with one (even unnamed) element (eg. cov.adj = list(c("constant","trend"))
).
Alternatively, if multiple features are specified, then the user has two possibilities:
provide a list with one element, then the same covariates are used for
adjustment for each feature. For example, if there are two features specified and the user inputs
cov.adj = list(c("constant","trend"))
, then a constant term and a linear trend are for adjustment for both features.
provide a list with as many elements as the number of features specified, then
feature-specific covariate adjustment is implemented. For example,
cov.adj = list('f1' = c("constant","trend"), 'f2' = c("trend"))
. In this case the name of each element
of the list should be one (and only one) of the features specified. Note that if two (or more) features are
specified and covariates adjustment has to be specified just for one of them, the user must still provide a list
of the same length of the number of features, e.g., cov.adj = list('f1' = c("constant","trend"), 'f2' = NULL
.
This option allows the user to include feature-specific constant terms or time trends by simply including "constant" or "trend" in the corresponding element of the list.
When outcome.var
is not included in features
, we automatically set , that is
we do not perform covariate adjustment. This is because, in this setting it is natural to create the out-of-sample
prediction matrix
using the post-treatment outcomes of the donor units only.
cointegrated.data
allows the user to model the belief that and
form a
cointegrated system. In practice, this implies that when dealing with the pseudo-true
residuals
, the first-difference of
are used rather than the levels.
The command returns an object of class 'scdata' containing the following
A |
a matrix containing pre-treatment features of the treated unit. |
B |
a matrix containing pre-treatment features of the control units. |
C |
a matrix containing covariates for adjustment. |
P |
a matrix whose rows are the vectors used to predict the out-of-sample series for the synthetic unit. |
Y.pre |
a matrix containing the pre-treatment outcome of the treated unit. |
Y.post |
a matrix containing the post-treatment outcome of the treated unit. |
Y.donors |
a matrix containing the pre-treatment outcome of the control units. |
specs |
a list containing some specifics of the data:
|
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
scdataMulti
, scest
, scpi
, scplot
, scplotMulti
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE)
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE)
scest
or scpi
for Point Estimation and Inference Procedures Using Synthetic Control Methods.The command prepares the data to be used by scest
or scpi
to implement estimation
and inference procedures for Synthetic Control (SC) methods
in the general case of multiple treated units and staggered adoption. It is a generalization of scdata
, since this latter prepares
the data in the particular case of a single treated unit.
The names of the output matrices follow the terminology proposed in Cattaneo, Feng, Palomba and Titiunik (2022).
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdata for data preparation in the single treated unit case, scest for point estimation, scpi for inference procedures, scplot and scplotMulti for plots in the single and multiple treated unit(s) cases, respectively.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
scdataMulti( df, id.var, time.var, outcome.var, treatment.var, features = NULL, cov.adj = NULL, cointegrated.data = FALSE, post.est = NULL, units.est = NULL, donors.est = NULL, anticipation = 0, effect = "unit-time", constant = FALSE, verbose = TRUE, sparse.matrices = FALSE )
scdataMulti( df, id.var, time.var, outcome.var, treatment.var, features = NULL, cov.adj = NULL, cointegrated.data = FALSE, post.est = NULL, units.est = NULL, donors.est = NULL, anticipation = 0, effect = "unit-time", constant = FALSE, verbose = TRUE, sparse.matrices = FALSE )
df |
a dataframe object. |
id.var |
a character with the name of the variable containing units' IDs. The ID variable can be numeric or character. |
time.var |
a character with the name of the time variable. The time variable has to be numeric, integer, or Date. In
case |
outcome.var |
a character with the name of the outcome variable. The outcome variable has to be numeric. |
treatment.var |
a character with the name of the variable containing the treatment assignment of each unit. The referenced variable has to take value 1 if the unit is treated in that period and value 0 otherwise. Please notice that, as common in the SC literature, we presume that once a unit is treated it remains treated forever. If treatment.var does not comply with this requirement the command would not work as expected! |
features |
a list containing the names of the feature variables used for estimation.
If this option is not specified the default is |
cov.adj |
a list specifying the names of the covariates to be used for adjustment for each feature. If |
cointegrated.data |
a logical that indicates if there is a belief that the data is cointegrated or not. The default value is |
post.est |
a scalar specifying the number of post-treatment periods or a list specifying the periods for which treatment effects have to be computed for each treated unit. It is only effective when effect = "unit-time". |
units.est |
a list specifying the treated units for which treatment effects have to be computed. |
donors.est |
a list specifying the donors units to be used. If the list has length 1, then all treated units share the same potential donors. Otherwise, if the user requires different donor pools for different treated units, the list must be of the same length of the number of treated units and each element has to be named with one treated unit's name as specified in id.var. |
anticipation |
a scalar that indicates the number of periods of potential anticipation effects. Default is 0. |
effect |
a string indicating the type of treatment effect to be computed. Options are: 'unit-time', which estimates treatment effects for each treated unit- post treatment period combination; 'unit', which estimates the treatment effect for each unit by averaging post-treatment features over time; 'time', which estimates the average treatment effect on the treated at various horizons. |
constant |
a logical which controls the inclusion of a constant term across features. The default value is |
verbose |
if |
sparse.matrices |
if |
Covariate-adjustment. See the Details section in scdata
for further information on how
to specify covariate-adjustment feature-by-feature.
Cointegration. cointegrated.data
allows the user to model the belief that and
form a
cointegrated system. In practice, this implies that when dealing with the pseudo-true
residuals
, the first-difference of
are used rather than the levels.
Effect. effect
allows the user to select between two causal quantities. The default
option, effect = "unit-time"
, prepares the data for estimation of
whereas the option effect = "unit"
prepares the data for estimation of
which is the average effect on the treated unit across multiple post-treatment periods.
The command returns an object of class 'scdataMulti' containing the following
A |
a matrix containing pre-treatment features of the treated units. |
B |
a matrix containing pre-treatment features of the control units. |
C |
a matrix containing covariates for adjustment. |
P |
a matrix whose rows are the vectors used to predict the out-of-sample series for the synthetic units. |
P.diff |
for internal use only. |
Y.df |
a dataframe containing the outcome variable for all units. |
Y.pre |
a matrix containing the pre-treatment outcome of the treated units. |
Y.post |
a matrix containing the post-treatment outcome of the treated units. |
Y.donors |
a matrix containing the pre-treatment outcome of the control units. |
specs |
a list containing some specifics of the data:
|
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
scdata
, scest
, scpi
, scplot
, scplotMulti
datager <- scpi_germany datager$tr_id <- 0 datager$tr_id[(datager$country == "West Germany" & datager$year > 1990)] <- 1 datager$tr_id[(datager$country == "Italy" & datager$year > 1992)] <- 0 outcome.var <- "gdp" id.var <- "country" treatment.var <- "tr_id" time.var <- "year" df.unit <- scdataMulti(datager, id.var = id.var, outcome.var = outcome.var, treatment.var = treatment.var, time.var = time.var, features = list(c("gdp", "trade")), cointegrated.data = TRUE, constant = TRUE)
datager <- scpi_germany datager$tr_id <- 0 datager$tr_id[(datager$country == "West Germany" & datager$year > 1990)] <- 1 datager$tr_id[(datager$country == "Italy" & datager$year > 1992)] <- 0 outcome.var <- "gdp" id.var <- "country" treatment.var <- "tr_id" time.var <- "year" df.unit <- scdataMulti(datager, id.var = id.var, outcome.var = outcome.var, treatment.var = treatment.var, time.var = time.var, features = list(c("gdp", "trade")), cointegrated.data = TRUE, constant = TRUE)
The command implements estimation procedures for Synthetic Control (SC) methods using least squares, lasso, ridge, or simplex-type constraints. For more information see Cattaneo, Feng, and Titiunik (2021).
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdata and scdataMulti for data preparation in the single and multiple treated unit(s) cases, respectively, scpi for inference procedures, scplot and scplotMulti for plots in the single and multiple treated unit(s) cases, respectively.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
scest( data, w.constr = NULL, V = "separate", V.mat = NULL, solver = "ECOS", plot = FALSE, plot.name = NULL, plot.path = NULL, save.data = NULL )
scest( data, w.constr = NULL, V = "separate", V.mat = NULL, solver = "ECOS", plot = FALSE, plot.name = NULL, plot.path = NULL, save.data = NULL )
data |
a class 'scdata' object, obtained by calling |
w.constr |
a list specifying the constraint set the estimated weights of the donors must belong to.
|
V |
specifies the type of weighting matrix to be used when minimizing the sum of squared residuals
The default is the identity matrix, so equal weight is given to all observations. In the case of multiple treated observations
(you used |
V.mat |
A conformable weighting matrix
See the Details section for more information on how to prepare this matrix. |
solver |
a string containing the name of the solver used by |
plot |
a logical specifying whether |
plot.name |
a string containing the name of the plot (the format is by default .png). For more options see |
plot.path |
a string containing the path at which the plot should be saved (default is output of |
save.data |
a character specifying the name and the path of the saved dataframe containing the processed data used to produce the plot. |
Information is provided for the simple case in which if not specified otherwise.
Estimation of Weights. w.constr
specifies the constraint set on the weights. First, the element
p
allows the user to choose between imposing a constraint on either the L1 (p = "L1"
)
or the L2 (p = "L2"
) norm of the weights and imposing no constraint on the norm (p = "no norm"
).
Second, Q
specifies the value of the constraint on the norm of the weights.
Third, lb
sets the lower bound of each component of the vector of weights.
Fourth, dir
sets the direction of the constraint on the norm in case p = "L1"
or p = "L2"
. If dir = "=="
, then
If instead dir = "<="
, then
If instead dir = "NULL"
no constraint on the norm of the weights is imposed.
An alternative to specifying an ad-hoc constraint set on the weights would be
choosing among some popular types of constraints. This can be done by including the element
'name
' in the list w.constr
. The following are available options:
If name == "simplex"
(the default), then
If name == "lasso"
, then
where Q
is by default equal to 1 but it can be provided as an element of the list (eg. w.constr =
list(name = "lasso", Q = 2)
).
If name == "ridge"
, then
where Q
is a tuning parameter that is by default computed as
where is the number of donors and
is the total number of covariates used for adjustment.
The user can provide
Q
as an element of the list (eg. w.constr =
list(name = "ridge", Q = 1)
).
If name == "ols"
, then the problem is unconstrained and the vector of weights
is estimated via ordinary least squares.
If name == "L1-L2"
, then
where is a tuning parameter computed as in the "ridge" case.
Weighting Matrix.
if V <- "separate"
, then and the minimized objective function is
which optimizes the separate fit for each treated unit.
if V <- "pooled"
, then and the minimized objective function is
which optimizes the pooled fit for the average of the treated units.
if the user wants to provide their own weighting matrix, then it must use the option V.mat
to input a positive-definite matrix, where
is the
number of rows of
(or
) after potential missing values have been removed. In case the user
wants to provide their own
V
, we suggest to check the appropriate dimension by inspecting the output
of either
scdata
or scdataMulti
and check the dimensions of (and
). Note that
the weighting matrix could cause problems to the optimizer if not properly scaled. For example, if
is diagonal
we suggest to divide each of its entries by
.
The function returns an object of class 'scest' containing two lists. The first list is labeled 'data' and
contains used data as returned by scdata
and some other values.
A |
a matrix containing pre-treatment features of the treated unit(s). |
B |
a matrix containing pre-treatment features of the control units. |
C |
a matrix containing covariates for adjustment. |
P |
a matrix whose rows are the vectors used to predict the out-of-sample series for the synthetic unit(s). |
P.diff |
for internal use only. |
Y.pre |
a matrix containing the (raw) pre-treatment outcome of the treated unit(s). |
Y.post |
a matrix containing the (raw) post-treatment outcome of the treated unit(s). |
Y.pre.agg |
a matrix containing the aggregate pre-treatment outcome of the treated unit(s). This differs from
Y.pre only in the case 'effect' in |
Y.post.agg |
a matrix containing the aggregate post-treatment outcome of the treated unit(s). This differs from
Y.post only in the case 'effect' in |
Y.donors |
a matrix containing the pre-treatment outcome of the control units. |
specs |
a list containing some specifics of the data:
|
The second list is labeled 'est.results' and contains estimation results.
w |
a matrix containing the estimated weights of the donors. |
r |
a matrix containing the values of the covariates used for adjustment. |
b |
a matrix containing |
Y.pre.fit |
a matrix containing the estimated pre-treatment outcome of the SC unit(s). |
Y.post.fit |
a matrix containing the estimated post-treatment outcome of the SC unit(s). |
A.hat |
a matrix containing the predicted values of the features of the treated unit(s). |
res |
a matrix containing the residuals |
V |
a matrix containing the weighting matrix used in estimation. |
w.constr |
a list containing the specifics of the constraint set used on the weights. |
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
scdataMulti
, scdata
, scpi
, scplot
, scplotMulti
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE) result <- scest(df, w.constr = list(name = "simplex", Q = 1)) result <- scest(df, w.constr = list(lb = 0, dir = "==", p = "L1", Q = 1))
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE) result <- scest(df, w.constr = list(name = "simplex", Q = 1)) result <- scest(df, w.constr = list(lb = 0, dir = "==", p = "L1", Q = 1))
The command implements estimation and inference procedures for Synthetic Control (SC) methods using least squares, lasso, ridge, or simplex-type constraints. Uncertainty is quantified using prediction
intervals according to Cattaneo, Feng, and Titiunik (2021). scpi
returns the estimated
post-treatment series for the synthetic unit through the command scest
and quantifies in-sample and out-of-sample uncertainty to provide confidence intervals
for each point estimate.
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdata and scdataMulti for data preparation in the single and multiple treated unit(s) cases, respectively, scest for point estimation, scplot and scplotMulti for plots in the single and multiple treated unit(s) cases, respectively.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
scpi( data, w.constr = NULL, V = "separate", V.mat = NULL, solver = "ECOS", P = NULL, u.missp = TRUE, u.sigma = "HC1", u.order = 1, u.lags = 0, u.design = NULL, u.alpha = 0.05, e.method = "all", e.order = 1, e.lags = 0, e.design = NULL, e.alpha = 0.05, sims = 200, rho = NULL, rho.max = 0.2, cores = 1, plot = FALSE, plot.name = NULL, w.bounds = NULL, e.bounds = NULL, force.joint.PI.optim = FALSE, save.data = NULL, verbose = TRUE )
scpi( data, w.constr = NULL, V = "separate", V.mat = NULL, solver = "ECOS", P = NULL, u.missp = TRUE, u.sigma = "HC1", u.order = 1, u.lags = 0, u.design = NULL, u.alpha = 0.05, e.method = "all", e.order = 1, e.lags = 0, e.design = NULL, e.alpha = 0.05, sims = 200, rho = NULL, rho.max = 0.2, cores = 1, plot = FALSE, plot.name = NULL, w.bounds = NULL, e.bounds = NULL, force.joint.PI.optim = FALSE, save.data = NULL, verbose = TRUE )
data |
a class 'scdata' object, obtained by calling |
w.constr |
a list specifying the constraint set the estimated weights of the donors must belong to.
|
V |
specifies the type of weighting matrix to be used when minimizing the sum of squared residuals
The default is the identity matrix, so equal weight is given to all observations. In the case of multiple treated observations
(you used |
V.mat |
A conformable weighting matrix
See the Details section for more information on how to prepare this matrix. |
solver |
a string containing the name of the solver used by |
P |
a |
u.missp |
a logical indicating if misspecification should be taken into account when dealing with |
u.sigma |
a string specifying the type of variance-covariance estimator to be used when estimating
the conditional variance of |
u.order |
a scalar that sets the order of the polynomial in |
u.lags |
a scalar that sets the number of lags of |
u.design |
a matrix with the same number of rows of |
u.alpha |
a scalar specifying the confidence level for in-sample uncertainty, i.e. 1 - |
e.method |
a string selecting the method to be used in quantifying out-of-sample uncertainty among:
"gaussian" which uses conditional subgaussian bounds; "ls" which specifies a location-scale model for |
e.order |
a scalar that sets the order of the polynomial in |
e.lags |
a scalar that sets the number of lags of |
e.design |
a matrix with the same number of rows of |
e.alpha |
a scalar specifying the confidence level for out-of-sample uncertainty, i.e. 1 - |
sims |
a scalar providing the number of simulations to be used in quantifying in-sample uncertainty. |
rho |
a string specifying the formula used for the regularizing parameter that imposes sparsity on the estimated vector of
weights. Users can provide a scalar with their own value for |
rho.max |
a scalar indicating the maximum value attainable by the tuning parameter |
cores |
number of cores to be used by the command. The default is one. When the weighting matrix |
plot |
a logical specifying whether |
plot.name |
a string containing the name of the plot (the format is by default .png). For more options see |
w.bounds |
a |
e.bounds |
a |
force.joint.PI.optim |
this option is here mostly for backward-compatibility. If FALSE (the default) it solves a separate optimization problem for each
treated unit when it comes to quantify in-sample uncertainty as long as the weighting matrix |
save.data |
a character specifying the name and the path of the saved dataframe containing the processed data used to produce the plot. |
verbose |
if |
Information is provided for the simple case in which if not specified otherwise.
Estimation of Weights. w.constr
specifies the constraint set on the weights. First, the element
p
allows the user to choose between imposing a constraint on either the L1 (p = "L1"
)
or the L2 (p = "L2"
) norm of the weights and imposing no constraint on the norm (p = "no norm"
).
Second, Q
specifies the value of the constraint on the norm of the weights.
Third, lb
sets the lower bound of each component of the vector of weights.
Fourth, dir
sets the direction of the constraint on the norm in case p = "L1"
or p = "L2"
. If dir = "=="
, then
If instead dir = "<="
, then
If instead dir = "NULL"
no constraint on the norm of the weights is imposed.
An alternative to specifying an ad-hoc constraint set on the weights would be
choosing among some popular types of constraints. This can be done by including the element
'name
' in the list w.constr
. The following are available options:
If name == "simplex"
(the default), then
If name == "lasso"
, then
where Q
is by default equal to 1 but it can be provided as an element of the list (eg. w.constr =
list(name = "lasso", Q = 2)
).
If name == "ridge"
, then
where is a tuning parameter that is by default computed as
where is the number of donors and
is the total number of covariates used for adjustment.
The user can provide
Q
as an element of the list (eg. w.constr =
list(name = "ridge", Q = 1)
).
If name == "ols"
, then the problem is unconstrained and the vector of weights
is estimated via ordinary least squares.
If name == "L1-L2"
, then
where is a tuning parameter computed as in the "ridge" case.
Weighting Matrix.
if V <- "separate"
, then and the minimized objective function is
which optimizes the separate fit for each treated unit.
if V <- "pooled"
, then and the minimized objective function is
which optimizes the pooled fit for the average of the treated units.
if the user wants to provide their own weighting matrix, then it must use the option V.mat
to input a positive-definite matrix, where
is the
number of rows of
(or
) after potential missing values have been removed. In case the user
wants to provide their own
V
, we suggest to check the appropriate dimension by inspecting the output
of either
scdata
or scdataMulti
and check the dimensions of (and
). Note that
the weighting matrix could cause problems to the optimizer if not properly scaled. For example, if
is diagonal
we suggest to divide each of its entries by
.
Regularization. rho
is estimated through the formula
where is the dimension of
and
denote the number of nonzeros in
if
rho = 'type-1'
and
if
rho = 'type-2'
,
rho = 'type-2'
is the default option from version 3.0.0 onwards, while previously 'type-1' was the default option. rho
defines a new sparse weight vector as
In-sample uncertainty. To quantify in-sample uncertainty it is necessary to model the pseudo-residuals .
First of all, estimation of the first moment of
can be controlled through
the option
u.missp
. When u.missp = FALSE
, then . If instead
u.missp = TRUE
,
then is estimated using a linear regression of
on
. The default set of variables in
is composed of
,
and, if required, it is augmented with lags (
u.lags
) and polynomials (u.order
) of .
The option
u.design
allows the user to provide an ad-hoc set of variables to form .
Regarding the second moment of
, different estimators can be chosen:
HC0, HC1, HC2, HC3, and HC4 using the option
u.sigma
.
Out-of-sample uncertainty. To quantify out-of-sample uncertainty it is necessary to model the out-of-sample residuals
and estimate relevant moments. By default, the design matrix used during estimation
is composed of the blocks in
and
corresponding to the outcome variable. Moreover, if required by the user,
is augmented with lags (
e.lags
) and polynomials (e.order
) of . The option
e.design
allows the user to provide an
ad-hoc set of variables to form . Finally, the option
e.method
allows the user to select one of three
estimation methods: "gaussian" relies on conditional sub-Gaussian bounds; "ls" estimates conditional bounds using a location-scale
model; "qreg" uses conditional quantile regression of the residuals on
.
Residual Estimation Over-fitting. To estimate conditional moments of and
we rely on two design matrices,
and
(see above). Let
and
be the number of
columns in
and
, respectively. Assuming no missing values and balanced features, the
number of observation used to estimate moments of
is
, whilst for moments of
is
.
Our rule of thumb to avoid over-fitting is to check if
or
. If the
former condition is not satisfied we automatically set
u.order = u.lags = 0
, if instead the latter is not met
we automatically set e.order = e.lags = 0
.
The function returns an object of class 'scpi' containing three lists. The first list is labeled 'data' and contains used
data as returned by scdata
and some other values.
A |
a matrix containing pre-treatment features of the treated unit(s). |
B |
a matrix containing pre-treatment features of the control units. |
C |
a matrix containing covariates for adjustment. |
P |
a matrix whose rows are the vectors used to predict the out-of-sample series for the synthetic unit(s). |
Y.pre |
a matrix containing the pre-treatment outcome of the treated unit(s). |
Y.post |
a matrix containing the post-treatment outcome of the treated unit(s). |
Y.pre.agg |
a matrix containing the aggregate pre-treatment outcome of the treated unit(s). This differs from
Y.pre only in the case 'effect' in |
Y.post.agg |
a matrix containing the aggregate post-treatment outcome of the treated unit(s). This differs from
Y.post only in the case 'effect' in |
Y.donors |
a matrix containing the pre-treatment outcome of the control units. |
specs |
a list containing some specifics of the data:
|
The second list is labeled 'est.results' containing all the results from scest
.
w |
a matrix containing the estimated weights of the donors. |
r |
a matrix containing the values of the covariates used for adjustment. |
b |
a matrix containing |
Y.pre.fit |
a matrix containing the estimated pre-treatment outcome of the SC unit(s). |
Y.post.fit |
a matrix containing the estimated post-treatment outcome of the SC unit(s). |
A.hat |
a matrix containing the predicted values of the features of the treated unit(s). |
res |
a matrix containing the residuals |
V |
a matrix containing the weighting matrix used in estimation. |
w.constr |
a list containing the specifics of the constraint set used on the weights. |
The third list is labeled 'inference.results' and contains all the inference-related results.
CI.in.sample |
a matrix containing the prediction intervals taking only in-sample uncertainty in to account. |
CI.all.gaussian |
a matrix containing the prediction intervals estimating out-of-sample uncertainty with sub-Gaussian bounds. |
CI.all.ls |
a matrix containing the prediction intervals estimating out-of-sample uncertainty with a location-scale model. |
CI.all.qreg |
a matrix containing the prediction intervals estimating out-of-sample uncertainty with quantile regressions. |
bounds |
a list containing the estimated bounds (in-sample and out-of-sample uncertainty). |
Sigma |
a matrix containing the estimated (conditional) variance-covariance |
u.mean |
a matrix containing the estimated (conditional) mean of the pseudo-residuals |
u.var |
a matrix containing the estimated (conditional) variance-covariance of the pseudo-residuals |
e.mean |
a matrix containing the estimated (conditional) mean of the out-of-sample error |
e.var |
a matrix containing the estimated (conditional) variance of the out-of-sample error |
u.missp |
a logical indicating whether the model has been treated as misspecified or not. |
u.lags |
an integer containing the number of lags in B used in predicting moments of the pseudo-residuals |
u.order |
an integer containing the order of the polynomial in B used in predicting moments of the pseudo-residuals |
u.sigma |
a string indicating the estimator used for |
u.user |
a logical indicating whether the design matrix to predict moments of |
u.T |
a scalar indicating the number of observations used to predict moments of |
u.params |
a scalar indicating the number of parameters used to predict moments of |
u.D |
the design matrix used to predict moments of |
u.alpha |
a scalar determining the confidence level used for in-sample uncertainty, i.e. 1- |
e.method |
a string indicating the specification used to predict moments of the out-of-sample error |
e.lags |
an integer containing the number of lags in B used in predicting moments of the out-of-sample error |
e.order |
an integer containing the order of the polynomial in B used in predicting moments of the out-of-sample error |
e.user |
a logical indicating whether the design matrix to predict moments of |
e.T |
a scalar indicating the number of observations used to predict moments of |
e.params |
a scalar indicating the number of parameters used to predict moments of |
e.alpha |
a scalar determining the confidence level used for out-of-sample uncertainty, i.e. 1- |
e.D |
the design matrix used to predict moments of |
rho |
an integer specifying the estimated regularizing parameter that imposes sparsity on the estimated vector of weights. |
Q.star |
a list containing the regularized constraint on the norm. |
sims |
an integer indicating the number of simulations used in quantifying in-sample uncertainty. |
failed.sims |
a matrix containing the percentage of failed simulations per post-treatment period to estimate lower and upper bounds. |
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
scdata
, scdataMulti
, scest
, scplot
, scplotMulti
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE) result <- scpi(df, w.constr = list(name = "simplex", Q = 1), cores = 1, sims = 10) result <- scpi(df, w.constr = list(lb = 0, dir = "==", p = "L1", Q = 1), cores = 1, sims = 10)
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE) result <- scpi(df, w.constr = list(name = "simplex", Q = 1), cores = 1, sims = 10) result <- scpi(df, w.constr = list(lb = 0, dir = "==", p = "L1", Q = 1), cores = 1, sims = 10)
A dataset containing some economic indicators of 17 OECD countries from 1960 to 2003.
scpi_germany
scpi_germany
A data frame with 748 rows and 11 variables:
country index.
name of the country.
time index, in years.
GDP per Capita (PPP, 2002 USD).
annual percentage change in consumer prices (base year 1995).
trade openness measured as export plus imports as percentage of GDP.
percentage of secondary school attained in the total population aged 25 and older.
industry share of value added.
https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/24714
The command plots the actual pre-treatment and post-treatment series of the treated
unit and the estimated counterfactual synthetic control unit with corresponding prediction intervals.
Prediction intervals can take into account either in-sample uncertainty only or in-sample and
out-of-sample uncertainty using the techniques developed in Cattaneo, Feng, and Titiunik (2021). scpi
.
The input object should come from the command scest
or from the command scpi
.
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdata and scdataMulti for data preparation in the single and multiple treated unit(s) cases, respectively, scest for point estimation, scpi for inference procedures, and scplotMulti for plots with multiple treated units.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
scplot( result, fig.path = NULL, fig.name = NULL, fig.format = "png", e.out = TRUE, joint = FALSE, col.treated = "black", col.synth = "mediumblue", label.xy = NULL, plot.range = NULL, x.ticks = NULL, event.label = NULL, plot.specs = NULL, save.data = NULL )
scplot( result, fig.path = NULL, fig.name = NULL, fig.format = "png", e.out = TRUE, joint = FALSE, col.treated = "black", col.synth = "mediumblue", label.xy = NULL, plot.range = NULL, x.ticks = NULL, event.label = NULL, plot.specs = NULL, save.data = NULL )
result |
a class 'scest' object, obtained by calling |
fig.path |
a string indicating the path where the plot(s) should be saved. |
fig.name |
a string indicating the name of the plot(s). If multiple plots will be saved the command automatically generates a numeric suffix to avoid overwriting them. |
fig.format |
a string indicating the format in which the plot(s) should be saved. |
e.out |
a logical specifying whether out-of-sample uncertainty should be included in the plot(s). |
joint |
a logical specifying whether simultaneous prediction intervals should be included in the plot(s). It requires |
col.treated |
a string specifying the color for the treated unit series. Find the full list at http://sape.inf.usi.ch/quick-reference/ggplot2/colour. |
col.synth |
a string specifying the color for the synthetic unit series. Find the full list at http://sape.inf.usi.ch/quick-reference/ggplot2/colour. |
label.xy |
a character list with two elements indicating the name of the axes (eg. label.xy = list(x.lab = "Year", y.lab = "GDP growth (%)")). |
plot.range |
a numeric array indicating the time range of the plot(s). |
x.ticks |
a numeric list containing the location of the ticks on the x axis. |
event.label |
a list containing a character object ('lab') indicating the label of the event and a numeric object indicating the height of the label in the plot. |
plot.specs |
a list containing some specifics to be passed to ggsave (eg. img.width, img.height, dpi) |
save.data |
a character specifying the name and the path of the saved dataframe containing the processed data used to produce the plot. |
plots |
a list containing standard ggplot object(s) that can be used for further customization. |
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022), scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
scdata
, scdataMulti
, scest
, scpi
, scplotMulti
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE) result <- scest(df, w.constr = list(name = "simplex", Q = 1)) scplot(result)
data <- scpi_germany df <- scdata(df = data, id.var = "country", time.var = "year", outcome.var = "gdp", period.pre = (1960:1990), period.post = (1991:2003), unit.tr = "West Germany", unit.co = setdiff(unique(data$country), "West Germany"), constant = TRUE, cointegrated.data = TRUE) result <- scest(df, w.constr = list(name = "simplex", Q = 1)) scplot(result)
The command produces a wide range of plots of Synthetic Control estimates and corresponding prediction intervals. The command allows form multiple treated units and staggered adoption.
Prediction intervals can take into account either in-sample uncertainty only or in-sample and
out-of-sample uncertainty using the techniques developed in Cattaneo, Feng, and Titiunik (2021). scpi
.
The input object should come from the command scest
or from the command scpi
.
Companion Stata and Python packages are described in Cattaneo, Feng, Palomba, and Titiunik (2022).
Companion commands are: scdata and scdataMulti for data preparation in the single and multiple treated unit(s) cases, respectively, scest for point estimation, scpi for inference procedures, and scplotMulti for plots with multiple treated units.
Related Stata, R, and Python packages useful for inference in SC designs are described in the following website:
https://nppackages.github.io/scpi/
For an introduction to synthetic control methods, see Abadie (2021) and references therein.
scplotMulti( result, type = "series", e.out = TRUE, joint = FALSE, col.treated = "black", col.synth = "mediumblue", scales = "fixed", point.size = 1.5, ncols = 3, save.data = NULL, verbose = TRUE )
scplotMulti( result, type = "series", e.out = TRUE, joint = FALSE, col.treated = "black", col.synth = "mediumblue", scales = "fixed", point.size = 1.5, ncols = 3, save.data = NULL, verbose = TRUE )
result |
a class 'scest' object, obtained by calling |
type |
a character that specifies the type of plot to be produced. If set to 'treatment' then treatment effects are plotted. If set to 'series' (default), the actual and synthetic time series are reported. |
e.out |
a logical specifying whether out-of-sample uncertainty should be included in the plot(s). |
joint |
a logical specifying whether simultaneous prediction intervals should be included in the plot(s). It requires |
col.treated |
a string specifying the color for the treated unit series. Find the full list at http://sape.inf.usi.ch/quick-reference/ggplot2/colour. |
col.synth |
a string specifying the color for the synthetic unit series. Find the full list at http://sape.inf.usi.ch/quick-reference/ggplot2/colour. |
scales |
should axes scales be fixed ("fixed", the default), free ("free"), or free in one dimension ("free_x", "free_y")? |
point.size |
a scalar controlling the size of points in the scatter plot. Default is 1.5. |
ncols |
an integer controlling the number of columns in the plot. |
save.data |
a character specifying the name and the path of the saved dataframe containing the processed data used to produce the plot. |
verbose |
if |
plots |
a list containing standard ggplot object(s) that can be used for further customization. |
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Abadie, A. (2021). Using synthetic controls: Feasibility, data requirements, and methodological aspects. Journal of Economic Literature, 59(2), 391-425.
Cattaneo, M. D., Feng, Y., and Titiunik, R. (2021). Prediction intervals for synthetic control methods. Journal of the American Statistical Association, 116(536), 1865-1880.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022), scpi: Uncertainty Quantification for Synthetic Control Methods, arXiv:2202.05984.
Cattaneo, M. D., Feng, Y., Palomba F., and Titiunik, R. (2022). Uncertainty Quantification in Synthetic Controls with Staggered Treatment Adoption, arXiv:2210.05026.
scdata
, scdataMulti
, scest
, scpi
, scplotMulti
datager <- scpi_germany datager$tr_id <- 0 datager$tr_id[(datager$country == "West Germany" & datager$year > 1990)] <- 1 datager$tr_id[(datager$country == "Italy" & datager$year > 1992)] <- 0 outcome.var <- "gdp" id.var <- "country" treatment.var <- "tr_id" time.var <- "year" df.unit <- scdataMulti(datager, id.var = id.var, outcome.var = outcome.var, treatment.var = treatment.var, time.var = time.var, features = list(c("gdp", "trade")), cointegrated.data = TRUE, constant = TRUE) res.unit <- scpi(df.unit, sims = 10, cores = 1) scplotMulti(res.unit, joint = TRUE)
datager <- scpi_germany datager$tr_id <- 0 datager$tr_id[(datager$country == "West Germany" & datager$year > 1990)] <- 1 datager$tr_id[(datager$country == "Italy" & datager$year > 1992)] <- 0 outcome.var <- "gdp" id.var <- "country" treatment.var <- "tr_id" time.var <- "year" df.unit <- scdataMulti(datager, id.var = id.var, outcome.var = outcome.var, treatment.var = treatment.var, time.var = time.var, features = list(c("gdp", "trade")), cointegrated.data = TRUE, constant = TRUE) res.unit <- scpi(df.unit, sims = 10, cores = 1) scplotMulti(res.unit, joint = TRUE)
The summary method for synthetic control prediction objects.
## S3 method for class 'scdata' summary(object, ...)
## S3 method for class 'scdata' summary(object, ...)
object |
Class "scest" object, obtained by calling |
... |
Additional arguments |
No return value, called to summarize scdata
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Supported methods: print.scdata
, summary.scdata
.
The summary method for synthetic control prediction objects.
## S3 method for class 'scdataMulti' summary(object, ...)
## S3 method for class 'scdataMulti' summary(object, ...)
object |
Class "scdataMulti" object, obtained by calling |
... |
Additional arguments |
No return value, called to summarize scdataMulti
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Supported methods: print.scdataMulti
, summary.scdataMulti
.
The summary method for synthetic control prediction fitted objects.
## S3 method for class 'scest' summary(object, ...)
## S3 method for class 'scest' summary(object, ...)
object |
Class "scest" object, obtained by calling |
... |
Additional arguments |
No return value, called to summarize scest
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Supported methods: print.scest
, summary.scest
, coef.scest
.
The summary method for synthetic control inference objects.
## S3 method for class 'scpi' summary(object, ...)
## S3 method for class 'scpi' summary(object, ...)
object |
Class "scpi" object, obtained by calling |
... |
Additional arguments |
No return value, called to summarize scpi
results.
Matias Cattaneo, Princeton University. [email protected].
Yingjie Feng, Tsinghua University. [email protected].
Filippo Palomba, Princeton University (maintainer). [email protected].
Rocio Titiunik, Princeton University. [email protected].
Supported methods: print.scpi
, summary.scpi
.