| simulate_sccic | R Documentation |
Generates data under controlled DGPs and evaluates SC-CIC performance.
simulate_sccic(
n_sims = 500,
T_pre = 25,
T_post = 15,
J = 15,
tau_true = 1,
dgp = c("linear", "nonlinear", "sc_good", "sc_bad"),
alpha = 1,
boot_iters = 200,
seed = 42,
verbose = TRUE
)
n_sims |
Integer. Number of simulation replications. |
T_pre |
Integer. Number of pre-treatment periods. |
T_post |
Integer. Number of post-treatment periods. |
J |
Integer. Number of donor units. |
tau_true |
Numeric. True average treatment effect. |
dgp |
Character. Data generating process. See Details. |
alpha |
Elastic net mixing parameter for SC construction. |
boot_iters |
Integer. Bootstrap iterations per simulation. |
seed |
Integer. Random seed. |
verbose |
Logical. Print progress. |
Four DGPs are available, designed to test different aspects of SC-CIC:
DGP 1: "linear" — Baseline.
Outcomes are linear in a common factor and unit-specific loadings.
DID is correctly specified. CIC matches DID. SC fits well.
Purpose: verify the method works in the easy case.
DGP 2: "nonlinear" — CIC advantage.
Cross-sectional DGP (not SC). N observations per cell.
Control and treated have different distributions of unobservables.
The production function is nonlinear and changes over time.
DID is biased due to the nonlinear distributional shift; CIC is correct.
Purpose: demonstrate the advantage of CIC over DID.
Note: this tests cic(), not sc_cic().
DGP 3: "sc_good" — SC with good distributional fit.
The treated unit is a true sparse combination of donors plus noise.
SC recovers the weights well; the distributional dynamics are similar.
Purpose: show SC-CIC works when SC fit is good.
DGP 4: "sc_bad" — SC with mean-only fit.
The SC matches the treated mean, but donors have much lower variance
than the treated unit. The distributional transport is wrong.
Purpose: show SC-CIC fails when distributional assumptions are violated.
A data frame with simulation results.
# Quick example (runs in seconds)
r <- simulate_sccic(n_sims = 2, dgp = "nonlinear", tau_true = 1, boot_iters = 5, verbose = FALSE)
summarize_simulation(r, tau_true = 1)
# Full simulation
r <- simulate_sccic(n_sims = 200, dgp = "nonlinear", tau_true = 1)
summarize_simulation(r, tau_true = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.