Reference

Types

MSC.MSCFitType
MSCFit

Fitted multivariate synthetic-control model. theta is an n_controls x n_treated matrix mapping control outcomes to treated counterfactual outcomes.

MSC.MSCEstimateType
MSCEstimate

Point estimate and fitted object for an MSC ATT analysis. Rows of counterfactual are post-treatment periods and columns are treated units.

MSC.MSCPanelType
MSCPanel

Balanced panel in matrix form. Rows 1:N0 are controls, rows N0+1:end are treated, columns 1:T0 are pre-treatment periods, and remaining columns are post-treatment periods.

Estimation

MSC.fit_mscFunction
fit_msc(Xpre, Ypre; kwargs...)

Fit the multivariate synthetic-control model from pre-treatment matrices.

Xpre is T0 x n_controls; Ypre is T0 x n_treated. The returned coefficient matrix maps controls to treated counterfactuals.

MSC.msc_estimateFunction
msc_estimate(Y, N0, T0; kwargs...)

Estimate ATT from an outcome panel matrix. Rows 1:N0 are controls, remaining rows are treated. Columns 1:T0 are pre-treatment periods.

MSC.predict_counterfactualFunction
predict_counterfactual(fit, Xpost)

Predict untreated counterfactual outcomes for treated units. Xpost is Tpost x n_controls; the result is Tpost x n_treated.

MSC.attFunction
att(fit, Xpost, Ytreated_post)

Estimate ATT from a fitted MSC model and post-treatment outcomes.

MSC.objectiveFunction
objective(X, Y, theta, lambda)

Evaluate the MSC objective (1 / sqrt(size(X, 1))) * ||Y - X * theta||_* + lambda * ||theta||_1.

MSC.coefFunction
coef(fit)

Return the n_controls x n_treated MSC weight matrix.

Panel Helpers and Simulation

MSC.panel_matricesFunction
panel_matrices(table, unit, time, outcome, treatment; treated_last=true)

Convert a balanced long panel to MSCPanel. Treatment must follow a common-adoption design: controls are never treated, treated units are untreated through T0 and treated in every post-treatment period.

MSC.simulate_mscFunction
simulate_msc(; kwargs...)

Generate a low-dimensional synthetic-control simulation with many treated units. Returns a named tuple with Y, N0, T0, true theta, untreated counterfactuals, and metadata.

Diagnostics

MSC.fitted_preFunction
fitted_pre(fit, Xpre)

Return fitted treated-unit outcomes in the pre-treatment period.

MSC.residualsFunction
residuals(fit, Xpre, Ypre)

Return pre-treatment residuals Ypre - fitted_pre(fit, Xpre).

MSC.prefit_rmseFunction
prefit_rmse(fit, Xpre, Ypre)

Root mean squared pre-treatment fitting error.

MSC.effect_matrixFunction
effect_matrix(est)

Return post-treatment effects by period and treated unit.

MSC.effect_curveFunction
effect_curve(est)

Average treatment effect by post-treatment period.

MSC.unit_effectsFunction
unit_effects(est)

Average treatment effect by treated unit.

MSC.weights_tableFunction
weights_table(fit; units=nothing, treated_units=nothing)

Return the estimated weight matrix as a DataFrame with one row per nonzero control-treated pair.

MSC.cv_tableFunction
cv_table(fit)

Return cross-validation errors by lambda. If the model was fit without CV, the error column is missing.

Placebos

MSC.placeboFunction
placebo(est; T0_placebo=nothing, kwargs...)

Move the treatment date into the pre-treatment period and estimate a placebo ATT.

placebo(Y, N0, T0; T0_placebo=floor(Int, T0/2), kwargs...)

Estimate a time-placebo effect using only the original pre-treatment periods.

MSC.placebo_distributionFunction
placebo_distribution(Y, N0, T0; replications=100, ntreated=nothing, kwargs...)

Randomly assign control units to placebo treatment groups and estimate MSC effects using the original treatment date. This is most useful when N0 is much larger than the number of treated units.

MSC.placebo_seFunction
placebo_se(Y, N0, T0; kwargs...)

Standard deviation of placebo_distribution.