SSC
Estimate dynamic treatment effects when states, countries, firms, markets, or other units adopt the same policy at different dates. RainbowStats builds unit-specific synthetic controls, aggregates the effects by periods since adoption, and produces placebo-in-time inference.
Syntax
model=SSC(outcomes,policyDate1,policyDate2,...)
model=SSC(outcomes,policyDate1,policyDate2,...,ARG(END_DATE,yyyymmdd),ARG(MAX_POST_PERIODS,n))
STAGGERED_SYNTHETIC_CONTROL is the long alias. Supply one policy date for every series in outcomes, in exactly the same order. Dates are integers in YYYYMMDD form. Use 0 when a unit remains untreated during the analysis.
| Argument | Description |
|---|---|
outcomes | A DataList containing one aligned outcome series per state, country, county, firm, market, or other unit. |
policyDate... | One adoption marker per outcome series. The first observation on or after the marker is treated. |
ARG(END_DATE,date) | Optional last calendar date included in the estimation sample. This is useful for excluding a later structural break such as COVID. |
ARG(MAX_POST_PERIODS,n) | Optional maximum event-time horizon. Shorter horizons preserve more contributors and more pretreatment placebo windows. |
Worked example: cannabis legalization and state productivity
This example asks whether the opening of licensed adult-use cannabis sales was followed by a change in state output per payroll job. Real state GDP is divided by quarterly payroll employment, and the 51 adoption markers correspond positionally to the series returned by LOOP_STATE2.
gdp=LOOP_STATE2($$RQGSP);
jobs=TO_QUARTERLY(LOOP_STATE2($$NA));
productivity=gdp/jobs;
model=SSC(productivity,0,20161029,20210122,0,20180101,20140101,20230110,20250801,0,0,0,0,0,20200101,0,0,0,0,0,20201009,20230701,20181120,20191201,20250916,0,20230203,20220101,0,20170701,0,20220421,20220401,20221229,0,0,0,20240806,0,20151001,0,20221201,0,0,0,0,20221001,0,20140708,0,0,0,ARG(END_DATE,20191231),ARG(MAX_POST_PERIODS,24));
SLIDESHOW(model);
END_DATE=20191231 deliberately ends the sample before COVID. Consequently, a late event-time increase in this run cannot be attributed to the pandemic. MAX_POST_PERIODS=24 limits the chart to six years after adoption.
productivity, the second date to the second series, and so on. Always inspect the DataList order before supplying a date vector. A correctly formatted date attached to the wrong state silently changes the research design.Extract and customize the event chart
event_chart returns an extractable D3LineChartOperator. Its numeric event-time axis can be relabeled and marked like any other D3 line chart.
chart=EXTRACT(model,event_chart);
chart=SET_TITLE(chart,Event-Time_Productivity_Effect_and_Shrinking_State_Coverage);
chart=SET_XAXIS(chart,Quarters_Since_Adult-Use_Cannabis_Sales);
chart=SET_YAXIS(chart,Estimated_Real_GDP_Per_Payroll_Job_Effect);
chart=ADD_XMARKER(chart,5,"MA out; N=6");
chart=ADD_XMARKER(chart,9,"CA out; N=5");
chart=ADD_XMARKER(chart,11,"NV out; N=4");
chart=ADD_XMARKER(chart,13,"AK out; N=3");
chart=ADD_XMARKER(chart,18,"OR out; N=2");
chart=ADD_XMARKER(chart,22,"WA out; N=1 (CO)");
chart;
| First affected event period | State leaving the average | Contributors remaining |
|---|---|---|
| 1–4 | None | 7 |
| 5 | Massachusetts | 6 |
| 9 | California | 5 |
| 11 | Nevada | 4 |
| 13 | Alaska | 3 |
| 18 | Oregon | 2 |
| 22 | Washington | 1 — Colorado |
Interpret the outcome carefully
gdp/jobs is a transparent proxy for real output per payroll job, not the official BLS measure of labor productivity per hour. A positive ratio effect can arise because output increases, because payroll employment falls, or both. Before giving the result a productivity interpretation, estimate the numerator and denominator separately.
The adult-use dates also do not identify a medical-cannabis mechanism. Medical access generally predates adult-use retail sales in these states. Testing that hypothesis requires a separate model built from consistent medical dispensary opening dates.
What the estimator does
- Aligns all outcome series and finds the common period before any included unit is treated.
- Represents each unit as a convex combination of the other units using the common untreated history.
- Jointly estimates treated unit-by-calendar-time effects.
- Aggregates those estimates by periods since adoption to form dynamic ATT estimates.
- Moves the treatment pattern through pretreatment history to obtain pointwise confidence intervals and p-values.
Extractable results
| Extract | Result |
|---|---|
slideshow | Complete diagnostic presentation. |
summary | Model dimensions, sample dates, aggregate effect, inference, and warnings. |
adoption | Policy-adoption timeline and sample treatment status. |
event_chart | Extractable D3 event-time ATT chart with estimates and 95% bounds. |
event_att | Matrix containing event time, ATT, lower and upper bounds, p-value, contributor count, and placebo-window count. |
unit_effects | Heterogeneous unit-by-calendar-time treatment effects. |
weights | Full donor-weight matrix. |
pre_fit | Pretreatment RMSPE and largest donor for every unit. |
min_eigenvalue | Identification and numerical-stability diagnostic. |
overall_att | Average across all identified treated unit-periods. |
json | Complete structured result for downstream applications. |
Required assumptions and diagnostics
- Adoption is absorbing: once treated, a unit remains treated.
- Treatment does not spill across units. Cross-border purchasing is a particular concern in state cannabis designs.
- Pretreatment relationships remain informative about untreated potential outcomes.
- Prediction errors are stationary and ergodic for placebo-in-time inference.
- The common pretreatment history is long relative to the post-treatment horizon.
- Pointwise confidence intervals are not simultaneous confidence bands.
Always inspect donor weights, pretreatment RMSPE, contributor counts, placebo-window counts, and the minimum eigenvalue. A persuasive-looking post-treatment path is not enough when fit is weak, the design is nearly singular, or late horizons represent only one unit.
Reference
Jianfei Cao, Shirley Lu, and Hang Wu, “Synthetic control inference for staggered adoption,” The Econometrics Journal, 29(3), 2026, 323–342.