pysynthcon 0.1.0b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pysynthcon-0.1.0b2/.readthedocs.yaml +17 -0
- pysynthcon-0.1.0b2/CHANGELOG.md +292 -0
- pysynthcon-0.1.0b2/CITATION.cff +15 -0
- pysynthcon-0.1.0b2/CONTRIBUTING.md +112 -0
- pysynthcon-0.1.0b2/LICENSE +674 -0
- pysynthcon-0.1.0b2/MANIFEST.in +19 -0
- pysynthcon-0.1.0b2/PKG-INFO +187 -0
- pysynthcon-0.1.0b2/README.md +128 -0
- pysynthcon-0.1.0b2/THIRD_PARTY_NOTICES.md +93 -0
- pysynthcon-0.1.0b2/docs/api.rst +85 -0
- pysynthcon-0.1.0b2/docs/assets/pysynthcon-header-compact.svg +157 -0
- pysynthcon-0.1.0b2/docs/assets/pysynthcon-header.svg +156 -0
- pysynthcon-0.1.0b2/docs/audit.md +280 -0
- pysynthcon-0.1.0b2/docs/backends.md +169 -0
- pysynthcon-0.1.0b2/docs/conf.py +57 -0
- pysynthcon-0.1.0b2/docs/data.md +130 -0
- pysynthcon-0.1.0b2/docs/development.md +11 -0
- pysynthcon-0.1.0b2/docs/differentiation.md +140 -0
- pysynthcon-0.1.0b2/docs/evaluation.md +206 -0
- pysynthcon-0.1.0b2/docs/examples.rst +42 -0
- pysynthcon-0.1.0b2/docs/getting-started.md +39 -0
- pysynthcon-0.1.0b2/docs/index.md +41 -0
- pysynthcon-0.1.0b2/docs/inference.md +288 -0
- pysynthcon-0.1.0b2/docs/methods.md +359 -0
- pysynthcon-0.1.0b2/docs/plotting.md +385 -0
- pysynthcon-0.1.0b2/docs/reference_backends.md +155 -0
- pysynthcon-0.1.0b2/docs/references.md +74 -0
- pysynthcon-0.1.0b2/docs/releasing.md +114 -0
- pysynthcon-0.1.0b2/docs/replication.md +309 -0
- pysynthcon-0.1.0b2/empirical_examples/basque.ipynb +1998 -0
- pysynthcon-0.1.0b2/empirical_examples/california.ipynb +2475 -0
- pysynthcon-0.1.0b2/empirical_examples/germany.ipynb +2010 -0
- pysynthcon-0.1.0b2/empirical_examples/kansas.ipynb +2077 -0
- pysynthcon-0.1.0b2/empirical_examples/rhode_island.ipynb +506 -0
- pysynthcon-0.1.0b2/pyproject.toml +67 -0
- pysynthcon-0.1.0b2/requirements-replication.txt +17 -0
- pysynthcon-0.1.0b2/scripts/create_notebooks.py +801 -0
- pysynthcon-0.1.0b2/scripts/execute_notebooks.py +72 -0
- pysynthcon-0.1.0b2/setup.cfg +4 -0
- pysynthcon-0.1.0b2/simulated_examples/donor_spillovers.ipynb +790 -0
- pysynthcon-0.1.0b2/src/pysynth/__init__.py +83 -0
- pysynthcon-0.1.0b2/src/pysynth/_mscmt_qp.py +45 -0
- pysynthcon-0.1.0b2/src/pysynth/_nested.py +285 -0
- pysynthcon-0.1.0b2/src/pysynth/_optim.py +106 -0
- pysynthcon-0.1.0b2/src/pysynth/_r.py +125 -0
- pysynthcon-0.1.0b2/src/pysynth/_r_synth.py +180 -0
- pysynthcon-0.1.0b2/src/pysynth/backends.py +835 -0
- pysynthcon-0.1.0b2/src/pysynth/classic.py +45 -0
- pysynthcon-0.1.0b2/src/pysynth/conformal.py +260 -0
- pysynthcon-0.1.0b2/src/pysynth/conformal_plotting.py +193 -0
- pysynthcon-0.1.0b2/src/pysynth/datasets.py +206 -0
- pysynthcon-0.1.0b2/src/pysynth/evaluation_plotting.py +256 -0
- pysynthcon-0.1.0b2/src/pysynth/fonts/STIXTwoText-OFL.txt +92 -0
- pysynthcon-0.1.0b2/src/pysynth/fonts/STIXTwoText-SemiBold.ttf +0 -0
- pysynthcon-0.1.0b2/src/pysynth/fonts/SourceSans3-LICENSE.md +93 -0
- pysynthcon-0.1.0b2/src/pysynth/fonts/SourceSans3-Regular.ttf +0 -0
- pysynthcon-0.1.0b2/src/pysynth/fonts/SourceSans3-Semibold.ttf +0 -0
- pysynthcon-0.1.0b2/src/pysynth/individual.py +541 -0
- pysynthcon-0.1.0b2/src/pysynth/inference.py +332 -0
- pysynthcon-0.1.0b2/src/pysynth/panel.py +198 -0
- pysynthcon-0.1.0b2/src/pysynth/placebo_plotting.py +240 -0
- pysynthcon-0.1.0b2/src/pysynth/plotting.py +1998 -0
- pysynthcon-0.1.0b2/src/pysynth/py.typed +0 -0
- pysynthcon-0.1.0b2/src/pysynth/replication.py +505 -0
- pysynthcon-0.1.0b2/src/pysynth/results.py +265 -0
- pysynthcon-0.1.0b2/src/pysynth/scul.py +255 -0
- pysynthcon-0.1.0b2/src/pysynth/sdid.py +532 -0
- pysynthcon-0.1.0b2/src/pysynth/sensitivity.py +204 -0
- pysynthcon-0.1.0b2/src/pysynth/validation.py +260 -0
- pysynthcon-0.1.0b2/src/pysynthcon.egg-info/PKG-INFO +187 -0
- pysynthcon-0.1.0b2/src/pysynthcon.egg-info/SOURCES.txt +109 -0
- pysynthcon-0.1.0b2/src/pysynthcon.egg-info/dependency_links.txt +1 -0
- pysynthcon-0.1.0b2/src/pysynthcon.egg-info/requires.txt +38 -0
- pysynthcon-0.1.0b2/src/pysynthcon.egg-info/top_level.txt +1 -0
- pysynthcon-0.1.0b2/tests/conftest.py +13 -0
- pysynthcon-0.1.0b2/tests/fixtures/basque_synth_r.json +120 -0
- pysynthcon-0.1.0b2/tests/fixtures/reference_backends_r.json +1 -0
- pysynthcon-0.1.0b2/tests/fixtures/scul_r.json +45 -0
- pysynthcon-0.1.0b2/tests/fixtures/sdid_extended_r.json +146 -0
- pysynthcon-0.1.0b2/tests/fixtures/sdid_inference_r.json +73 -0
- pysynthcon-0.1.0b2/tests/fixtures/sdid_r.json +121 -0
- pysynthcon-0.1.0b2/tests/test_assignment_sensitivity.py +99 -0
- pysynthcon-0.1.0b2/tests/test_assignment_sensitivity_plotting.py +124 -0
- pysynthcon-0.1.0b2/tests/test_backends.py +464 -0
- pysynthcon-0.1.0b2/tests/test_california_inference.py +43 -0
- pysynthcon-0.1.0b2/tests/test_classic.py +95 -0
- pysynthcon-0.1.0b2/tests/test_conformal.py +212 -0
- pysynthcon-0.1.0b2/tests/test_conformal_plotting.py +96 -0
- pysynthcon-0.1.0b2/tests/test_datasets.py +68 -0
- pysynthcon-0.1.0b2/tests/test_donor_spillovers_example.py +75 -0
- pysynthcon-0.1.0b2/tests/test_estimators.py +192 -0
- pysynthcon-0.1.0b2/tests/test_evaluation_plotting.py +165 -0
- pysynthcon-0.1.0b2/tests/test_individual.py +268 -0
- pysynthcon-0.1.0b2/tests/test_literature.py +202 -0
- pysynthcon-0.1.0b2/tests/test_local_references.py +121 -0
- pysynthcon-0.1.0b2/tests/test_mscmt_qp.py +39 -0
- pysynthcon-0.1.0b2/tests/test_nested.py +72 -0
- pysynthcon-0.1.0b2/tests/test_notebook_execution.py +98 -0
- pysynthcon-0.1.0b2/tests/test_notebook_sources.py +141 -0
- pysynthcon-0.1.0b2/tests/test_panel.py +170 -0
- pysynthcon-0.1.0b2/tests/test_placebo.py +304 -0
- pysynthcon-0.1.0b2/tests/test_plotting.py +942 -0
- pysynthcon-0.1.0b2/tests/test_r_references.py +228 -0
- pysynthcon-0.1.0b2/tests/test_r_synth.py +126 -0
- pysynthcon-0.1.0b2/tests/test_results.py +79 -0
- pysynthcon-0.1.0b2/tests/test_scul_preprocessing.py +75 -0
- pysynthcon-0.1.0b2/tests/test_sdid_convergence.py +300 -0
- pysynthcon-0.1.0b2/tests/test_sdid_inference.py +222 -0
- pysynthcon-0.1.0b2/tests/test_sensitivity.py +389 -0
- pysynthcon-0.1.0b2/tests/test_twostage_reference.py +186 -0
- pysynthcon-0.1.0b2/tests/test_validation.py +386 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are documented here. Versioning follows semantic
|
|
4
|
+
versioning; the API may evolve during the 0.x research releases.
|
|
5
|
+
|
|
6
|
+
## 0.1.0b2 — 2026-11-29
|
|
7
|
+
|
|
8
|
+
The public distribution name is `pysynthcon`. Install this beta with
|
|
9
|
+
`python -m pip install 'pysynthcon==0.1.0b2'` and use `import pysynth`.
|
|
10
|
+
This release updates package metadata, installation examples and the
|
|
11
|
+
publishing workflow. The estimators and their numerical specifications are
|
|
12
|
+
the same as the preceding GitHub beta.
|
|
13
|
+
|
|
14
|
+
If you installed the b1 GitHub wheel as `pysynth-control`, use a fresh
|
|
15
|
+
environment or uninstall that distribution before installing `pysynthcon`.
|
|
16
|
+
Both wheels provide the same Python import namespace.
|
|
17
|
+
|
|
18
|
+
## 0.1.0b1 — 2026-11-29
|
|
19
|
+
|
|
20
|
+
First GitHub beta of PySynthCon by Charles Rahal, Anda Raluca Epure, and Daniel Valdenegro.
|
|
21
|
+
|
|
22
|
+
- The GitHub wheel used the distribution name `pysynth-control` with the `pysynth` import. The optional Python backends now install from PyPI. The replication environment retains its original source pin.
|
|
23
|
+
- The source archive includes the five empirical notebooks and the spillover simulation. The manual includes the public API, identification assumptions, published benchmarks and instructions for the separately provisioned R backends.
|
|
24
|
+
- This beta brings together the estimator and inference changes documented below.
|
|
25
|
+
|
|
26
|
+
### Assignment sensitivity, event time and numerical corrections
|
|
27
|
+
|
|
28
|
+
- Add Firpo–Possebom sensitivity bounds and user-specified assignment probabilities to full in-space reassignment tests. Plot the attainable p-value range against the probability ratio. Endpoint labels use their rendered height on single-column figures. The California notebook exports the figure and bounds and checks that a twofold assignment ratio gives a p-value interval of [1/77, 2/40].
|
|
29
|
+
- Preserve exact placebo MSPE ties and inclusive pre-fit cutoffs. Correct conformal tests where high outcome levels erased the imposed effect or numerical differences among equal residual scores changed the permutation rank.
|
|
30
|
+
- Calculate SDID weight updates in donor-minus-treated differences. Protect the reference line search, stopping rule and standard error across measurement units. Validate supplied inference paths on the effect scale.
|
|
31
|
+
- Align labelled ISC and 2SISC predictor matrices by date and unit. Support user-specified integer event times for irregular visits and report the weight and number of observed cases at each offset. Correct a premature simplex fallback exit in MSCMT.
|
|
32
|
+
- Require the full published sample window when comparing against study benchmarks. Preserve mixed integer/float treatment gaps and reject panel inputs that silently lose integer outcome differences on conversion.
|
|
33
|
+
- Solve the robust SCM ridge problem in its retained singular-vector basis. Wide donor pools use a penalty matrix sized by retained rank.
|
|
34
|
+
|
|
35
|
+
### Inference and numerical audit
|
|
36
|
+
|
|
37
|
+
- Add sharp-path conformal tests for outcome-matching SCM and pointwise inversion over a supplied effect grid. Return every rotation and score, null-imposed weights and residuals. Plot accepted grid candidates with optional independently sourced endpoints.
|
|
38
|
+
- Reproduce four Rhode Island p-values and six annual pointwise sets in a new empirical notebook. The existing paired spillover simulation now tests the known effect path under clean and exposed donor pools.
|
|
39
|
+
- Add full in-space treatment reassignment, panel-specific estimator factories, optional parallel refits, squared-error screens, and placebo gap plots. The California notebook uses the original smoking covariates and all 39 assignments in both the local R Synth package and the checked Python predictor optimizer. The untreated-only pool remains the default.
|
|
40
|
+
- Correct false convergence in outcome SCM when a remote donor sets the numerical scale. Record any improving donor transfers and enforce the iteration budget. Require a boolean for the historical post-treatment predictor override.
|
|
41
|
+
- Read the Stata tobacco predictors and the Rhode Island supplement directly from checksum-verified response bytes.
|
|
42
|
+
|
|
43
|
+
### Estimator attribution
|
|
44
|
+
|
|
45
|
+
- Give predictor-based, ridge-augmented, penalized and robust SCM their own
|
|
46
|
+
public classes and cite the original methodology for each. Expose the
|
|
47
|
+
differenced specification under its own name and identify its working-paper
|
|
48
|
+
source. Existing backend selectors remain available for compatibility.
|
|
49
|
+
- Compare each named specification once in the empirical notebooks. Classical
|
|
50
|
+
predictor SCM uses three prespecified pretreatment outcome means. The
|
|
51
|
+
historical fits keep their original predictor designs. Germany’s figures
|
|
52
|
+
cite the paper’s approximate annual GDP effect.
|
|
53
|
+
|
|
54
|
+
### Documentation and figures
|
|
55
|
+
|
|
56
|
+
- Place the fitted mean ATT in the lower-left corner of effect panels and
|
|
57
|
+
remove its arrow. The dotted line shows the mean over the treated periods.
|
|
58
|
+
- Keep each estimator in one equally sized effect panel. The Basque example
|
|
59
|
+
shows all twelve fits in a three-column grid, with the paper and R Synth
|
|
60
|
+
comparisons printed inside the historical SCM panel.
|
|
61
|
+
- Keep the ATT and pretreatment RMSE dots on evenly spaced rows when a fit
|
|
62
|
+
has several reference comparisons. Numbered keys beside the estimator
|
|
63
|
+
lead to the values and evaluation windows in the figure’s citation lines.
|
|
64
|
+
- Set figure titles in STIX Two Text and labels, ticks and estimates in
|
|
65
|
+
Source Sans 3. Bundle the fonts for consistent publication exports and
|
|
66
|
+
use the same pairing in the desktop and mobile README headers.
|
|
67
|
+
- Measure multiline captions and stacked published estimates with the active
|
|
68
|
+
renderer so their labels fit across Matplotlib versions.
|
|
69
|
+
- Use the PySynthCon name in the README, citation, documentation and exported
|
|
70
|
+
figure credits. The README header shows the California SDID estimate with
|
|
71
|
+
separate layouts for desktop and mobile screens.
|
|
72
|
+
|
|
73
|
+
### Simulation and notebook outputs
|
|
74
|
+
|
|
75
|
+
- Add a seeded, paired regional-policy simulation comparing outcome SCM and
|
|
76
|
+
DID under donor spillovers. It uses expanding-window validation, a named
|
|
77
|
+
donor-group exclusion and known potential outcomes to measure estimation error.
|
|
78
|
+
- Write standalone figures, tables and diagnostics from every notebook under
|
|
79
|
+
the checkout's `outputs/` directory. Export complete empirical donor weights,
|
|
80
|
+
selection results, replication checks, warnings and software versions.
|
|
81
|
+
Empirical source data download into memory. Simulation panels are generated
|
|
82
|
+
in memory from the recorded seed.
|
|
83
|
+
- `scripts/execute_notebooks.py` runs the four empirical studies and the
|
|
84
|
+
simulation. `--examples` selects studies, and `--output-dir` selects the
|
|
85
|
+
destination of executed notebook copies.
|
|
86
|
+
|
|
87
|
+
### Estimator and replication audit
|
|
88
|
+
|
|
89
|
+
- Check successful pysyncon simplex solves for a feasible step that improves
|
|
90
|
+
the objective beyond the solver tolerance. Recover the same quadratic when
|
|
91
|
+
this check fails. Handle undefined scaled imbalance after a completed
|
|
92
|
+
AugSynth fit and reject singular unregularized or residualized designs.
|
|
93
|
+
- Validate complete, finite, aligned paths before computing effects, placebo
|
|
94
|
+
ranks or validation scores. Preserve refit results when a custom estimator
|
|
95
|
+
reuses a prediction buffer. Check an existing SDID fit against the
|
|
96
|
+
counterfactual and intercept implied by its weights.
|
|
97
|
+
- Reject bare strings passed as collections of unit IDs. This prevents
|
|
98
|
+
`treated_units="CA"` from silently assigning treatment to units `C` and `A`.
|
|
99
|
+
In placebo output, `at_least_treated_ratio` records the rank comparison
|
|
100
|
+
even when the displayed post/pre RMSPE ratio exceeds floating-point range.
|
|
101
|
+
- Correct numeric scaling in SCUL's optional Python backend, 2SISC neighbor
|
|
102
|
+
ordering and extreme placebo ratios. Permit a fixed SCUL penalty with one
|
|
103
|
+
post-treatment observation in the original R backend.
|
|
104
|
+
- Validate historical calendars and Kansas's sixteen quarterly effects.
|
|
105
|
+
Distinguish the Basque paper's qualitative headline from its Figure 2
|
|
106
|
+
percentage series. Direct labels show a bound for differences smaller
|
|
107
|
+
than display precision. CSVs retain the full numerical difference.
|
|
108
|
+
Put grouped solver warnings below notebook figures. The Kansas donor
|
|
109
|
+
sensitivity chart labels states using the study's FIPS-to-name mapping.
|
|
110
|
+
- Limit notebook execution to the four published examples, and report a
|
|
111
|
+
missing notebook as an error. Include only those notebooks and the two
|
|
112
|
+
development scripts in their respective source-distribution directories.
|
|
113
|
+
Check explicitly supplied R library directories before a reference fit.
|
|
114
|
+
|
|
115
|
+
### Direct figure annotations
|
|
116
|
+
|
|
117
|
+
- Label observed and counterfactual curves at their endpoints; place sourced
|
|
118
|
+
comparisons, reproduced values and signed differences beside their matching
|
|
119
|
+
paths, effect panels and ATT rows. Direct annotation is the default; the
|
|
120
|
+
earlier reference table remains available with `reference_style="strip"`.
|
|
121
|
+
- Give historical fits absent from the comparison their own labelled rows or
|
|
122
|
+
panels. Keep percentage and subset-window comparisons distinct from
|
|
123
|
+
full-period, level-scale ATT markers.
|
|
124
|
+
- Label validation minima, baseline ATTs and the donor exclusions responsible
|
|
125
|
+
for the largest sensitivity changes directly on the evaluation figures.
|
|
126
|
+
- Move full specifications and audit tables into expandable notebook sections
|
|
127
|
+
below the figures, with concise source citations and local export paths.
|
|
128
|
+
|
|
129
|
+
### SDID inference convergence
|
|
130
|
+
|
|
131
|
+
- Add an explicit inference iteration-budget override, including when a
|
|
132
|
+
fitted estimate is supplied. Preserve original penalties, tolerance,
|
|
133
|
+
starting weights, sparsification and resampling plans.
|
|
134
|
+
- Add a strict convergence option that rejects unresolved resampled fits;
|
|
135
|
+
report capped draws by weight type and retain objective-decrease thresholds,
|
|
136
|
+
terminal decreases, dual gaps and iteration budgets in diagnostics.
|
|
137
|
+
- Make iteration-limit warnings actionable. Keep exact original-cap
|
|
138
|
+
replication and compare it with a complete extended-budget run in every
|
|
139
|
+
notebook, showing standard-error changes and exporting draw-level diagnostics.
|
|
140
|
+
|
|
141
|
+
### Comparative research workflows
|
|
142
|
+
|
|
143
|
+
- Add common expanding-window pretreatment validation across estimator
|
|
144
|
+
families and tuning candidates, masking held-out treated outcomes and
|
|
145
|
+
excluding all actual post-treatment rows. Preserve fold predictions,
|
|
146
|
+
pooled scoring, solver diagnostics and fresh estimator instances.
|
|
147
|
+
- Add validation-based specification selection and full-panel refitting,
|
|
148
|
+
including prespecified 2SISC neighbor grids. Document the optimistic selected
|
|
149
|
+
score and absence of post-selection inference guarantees.
|
|
150
|
+
- Add complete donor-deletion and named-group exclusion refits, with baseline
|
|
151
|
+
paths, ATT changes, sign reversals and diagnostic tables. Rerun 2SISC
|
|
152
|
+
screening within every eligible pool; retain zero- and negative-weight donors.
|
|
153
|
+
- Add publication plots for validation and donor sensitivity, and demonstrate
|
|
154
|
+
both workflows in all four empirical notebooks.
|
|
155
|
+
- Credit Petrillo et al. (2025) for two-stage ISC. Make the authors' core Python
|
|
156
|
+
specification the 2SISC default: raw nearest-neighbor screening followed by
|
|
157
|
+
temporal-mean predictor SCM, without donor resampling. Preserve the earlier
|
|
158
|
+
variant through `backend="mscmt", n_bootstrap=50`. Document the source's
|
|
159
|
+
treated-inclusive neighbor-count convention and study-specific limitations.
|
|
160
|
+
- Document differentiation from pysyncon and related tools, crediting existing
|
|
161
|
+
methods and diagnostics without claiming new causal identification.
|
|
162
|
+
|
|
163
|
+
### Audit corrections
|
|
164
|
+
|
|
165
|
+
- Correct Basque eligibility to 16 regional donors and reproduce paper Table 3
|
|
166
|
+
using mean annual education shares. Add independent original-R Synth checks
|
|
167
|
+
of predictors, weights and the full path at absolute tolerance `1e-4`.
|
|
168
|
+
- Restore original SCUL near-zero-variance screening across full series and
|
|
169
|
+
every training fold; allow one-origin median/minimum selection.
|
|
170
|
+
- Preserve SCM predictions across measurement-unit and common-level changes;
|
|
171
|
+
retain informative lags regardless of absolute outcome scale.
|
|
172
|
+
- Check pysyncon inner/outer termination and recover failed solves without
|
|
173
|
+
changing objectives. Reject silent post-treatment predictor use and mismatched
|
|
174
|
+
outcome data; record Germany’s explicit historical exception.
|
|
175
|
+
- Correct robust SCM handling of genuine zeros, singular-value thresholds and
|
|
176
|
+
denoised prediction; validate against the published SVD/ridge equations.
|
|
177
|
+
- Make RMSPE and generic placebo ranks scale invariant; validate supplied SDID
|
|
178
|
+
time-weight alignment and simplex weights. Clarify the descriptive placebo
|
|
179
|
+
rank and the original SDID paper/software finite-sample differences.
|
|
180
|
+
- Fix invalid local diagnostic JSON, validate generated notebook code, and
|
|
181
|
+
clean up notebook kernels after success or failure. Regenerate empirical
|
|
182
|
+
comparisons after the audit. R and auxiliary exports
|
|
183
|
+
remain local-only; source distributions explicitly exclude restored ignored
|
|
184
|
+
helpers and executed notebook copies. See `docs/audit.md` for sources, evidence and limits.
|
|
185
|
+
|
|
186
|
+
### Added
|
|
187
|
+
|
|
188
|
+
- Original synthdid bootstrap, jackknife and placebo variance procedures,
|
|
189
|
+
independent draw-by-draw R checks, and the reference `sc_estimate` variant.
|
|
190
|
+
- Paired source/reproduction/difference annotations with matched statistics
|
|
191
|
+
and periods; archived earlier-software comparisons, fitting times and
|
|
192
|
+
optimizer diagnostics in every notebook.
|
|
193
|
+
- Pinned R reference installer and original SCUL/MSCMT integration checks.
|
|
194
|
+
- Sourced `LiteratureBenchmark` annotations on every empirical figure, with
|
|
195
|
+
compatible mean-effect guides, linked citations and explicit source windows.
|
|
196
|
+
Paper findings are distinguished from the authors' Kansas worked example.
|
|
197
|
+
- Publication plotting API: observed/counterfactual paths, shared-scale
|
|
198
|
+
effect panels and aligned ATT/pretreatment-RMSE summaries, with explicit
|
|
199
|
+
units, intervention markers and no invented uncertainty intervals.
|
|
200
|
+
- Vector PDF/SVG and 300 dpi PNG export, embedded PDF fonts, editable SVG
|
|
201
|
+
text and scoped styling that preserves global Matplotlib settings.
|
|
202
|
+
- Three redesigned figures in every empirical notebook, downloadable
|
|
203
|
+
exports and CSV comparison values, plus a dedicated plotting guide.
|
|
204
|
+
- Figure tests for calendar spacing, treatment boundaries, common scales,
|
|
205
|
+
summary values, sample compatibility, font export and physical dimensions.
|
|
206
|
+
- Explicit `TwoStageIndividualSC` estimator, labelled **Two-Stage Individual
|
|
207
|
+
Synthetic Control (2SISC)**: nearest-neighbor screening on pretreatment
|
|
208
|
+
features, followed by the authors' mean-predictor fit within that group;
|
|
209
|
+
the separate MSCMT/resampling variant remains available explicitly.
|
|
210
|
+
- Separate ISC and 2SISC rows in all four executed empirical notebooks,
|
|
211
|
+
bringing each comparison to twelve interfaces.
|
|
212
|
+
- Donor-selection metadata and analytic checks for full-pool equivalence,
|
|
213
|
+
neighbor ties, feature matching, aggregation and post-treatment leakage.
|
|
214
|
+
|
|
215
|
+
### Changed
|
|
216
|
+
|
|
217
|
+
- Generated figure exports, diagnostic tables and prior-output archives are
|
|
218
|
+
local-only; executed notebooks retain their embedded figures and results.
|
|
219
|
+
- R source and reference setup/validation utilities are local-only dependencies,
|
|
220
|
+
selected through `PYSYNTH_REFERENCE_DIR`. They are excluded from the repository
|
|
221
|
+
and distributions. Full SCUL/ISC fits and California's exact paper sampling
|
|
222
|
+
plan require the separately supplied bundle. GitHub CI runs Python checks;
|
|
223
|
+
original-R integration remains available locally.
|
|
224
|
+
- SCUL defaults to the original R `lambda.median` procedure with fold-specific
|
|
225
|
+
glmnet paths. ISC defaults to MSCMT and 50 donor resamples; the explicit
|
|
226
|
+
MSCMT variant of 2SISC retains that workflow.
|
|
227
|
+
R dependencies are required for these fits; the previous native
|
|
228
|
+
approximations require explicit selection.
|
|
229
|
+
- pysyncon SCM estimates predictor importance instead of injecting fixed V.
|
|
230
|
+
SyntheticControlMethods uses all pre-outcome lags and all ten original starts.
|
|
231
|
+
- Nested SCM optimization now checks termination, improves inner numerical
|
|
232
|
+
conditioning, differentiates the same objective through a certified inner
|
|
233
|
+
optimum, and recovers failed line searches or unavailable derivatives with
|
|
234
|
+
bounded Powell. Failed recovery raises rather than returning an unchecked fit.
|
|
235
|
+
- ISC preserves the original R donor-sampling stream across individuals.
|
|
236
|
+
Failed final MSCMT WNNLS solves are repaired on the same weighted simplex
|
|
237
|
+
objective, with independently checked optimality gaps and recorded diagnostics.
|
|
238
|
+
- Every empirical notebook runs full fits and 200 original SDID placebo refits.
|
|
239
|
+
- California also reproduces the paper's 8.4 SDID standard error using the
|
|
240
|
+
authors' exact R resampling plan; every resample is exported for inspection.
|
|
241
|
+
- German figure units now state PPP-adjusted current US dollars, following
|
|
242
|
+
the authors' 2025 erratum; the unit-label correction does not alter the data.
|
|
243
|
+
- `Estimate.plot()` now uses the publication style and accepts plot labels
|
|
244
|
+
and captions while retaining its Axes return value.
|
|
245
|
+
- Notebook generation uses stable cell IDs and public plotting functions;
|
|
246
|
+
custom execution directories include their linked figure exports.
|
|
247
|
+
- `IndividualSC()` now unambiguously denotes vanilla ISC over the full
|
|
248
|
+
eligible donor pool. Replace the initial API's
|
|
249
|
+
`IndividualSC(n_neighbors=k)` with `TwoStageIndividualSC(n_neighbors=k)`.
|
|
250
|
+
- Both individual estimators take keyword-only options and return method
|
|
251
|
+
labels `ISC` and `2SISC`. Donor resampling remains a conditional sensitivity
|
|
252
|
+
diagnostic; the MSCMT variant of 2SISC keeps its stage-one donor group fixed
|
|
253
|
+
during resampling.
|
|
254
|
+
|
|
255
|
+
## Development snapshot — 2026-11-23
|
|
256
|
+
|
|
257
|
+
This entry records the initial source implementation before the first public beta. Its features and scope limits describe that snapshot.
|
|
258
|
+
|
|
259
|
+
### Added
|
|
260
|
+
|
|
261
|
+
- Installable `pysynth-control` distribution with the `pysynth` import namespace.
|
|
262
|
+
- Validated balanced panels, labelled estimates, comparison tables and plots.
|
|
263
|
+
- Native convex outcome SCM and DID baselines.
|
|
264
|
+
- SCUL with rolling-origin lasso selection, fold-local preprocessing and
|
|
265
|
+
explicit common-grid selection rules.
|
|
266
|
+
- Individual synthetic controls with nearest-donor screening, conditional
|
|
267
|
+
donor resampling, case-specific panels and event-time aggregation.
|
|
268
|
+
- Native SDID with unit/time weights, treated blocks, reference Frank–Wolfe
|
|
269
|
+
optimization and convergence diagnostics.
|
|
270
|
+
- Optional adapters for pysyncon SCM, augmented, penalized and robust methods,
|
|
271
|
+
and SyntheticControlMethods SCM and differenced SCM.
|
|
272
|
+
- In-space placebo diagnostics with explicit donor exclusion and rank rules.
|
|
273
|
+
- requests-based immutable, hash-verified academic dataset downloads.
|
|
274
|
+
- Four empirical notebooks: California, Basque Country, Germany and Kansas.
|
|
275
|
+
- Independent R fixtures, analytic tests, academic reference checks, CI,
|
|
276
|
+
full Sphinx documentation, citation metadata and contributor guidance.
|
|
277
|
+
|
|
278
|
+
### Compatibility
|
|
279
|
+
|
|
280
|
+
- Pinned pysyncon revision for corrected augmented-SCM replications.
|
|
281
|
+
- Local SyntheticControlMethods fixes for pandas differencing alignment and
|
|
282
|
+
string unit IDs, predictor residual broadcasting and predictor scaling;
|
|
283
|
+
one optimization start avoids its SciPy initialization shape issue.
|
|
284
|
+
|
|
285
|
+
### Known scope limits
|
|
286
|
+
|
|
287
|
+
- No automatic staggered-adoption estimator or missing-outcome imputation.
|
|
288
|
+
- No common confidence-interval API or synthdid variance implementations.
|
|
289
|
+
- SCUL median-grid option differs from glmnet's automatic default paths.
|
|
290
|
+
- IndividualSC does not reproduce MSCMT predictor weighting or the complete
|
|
291
|
+
original survey/scanner-data studies. New-method applications in the
|
|
292
|
+
notebooks are labelled separately from validated reference specifications.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "Please cite PySynthCon, the underlying method papers, and upstream packages used."
|
|
3
|
+
title: "PySynthCon: comparable synthetic control methods in Python"
|
|
4
|
+
type: software
|
|
5
|
+
authors:
|
|
6
|
+
- family-names: Rahal
|
|
7
|
+
given-names: Charles
|
|
8
|
+
- family-names: Epure
|
|
9
|
+
given-names: Anda Raluca
|
|
10
|
+
- family-names: Valdenegro
|
|
11
|
+
given-names: Daniel
|
|
12
|
+
version: "0.1.0b2"
|
|
13
|
+
date-released: 2026-11-29
|
|
14
|
+
repository-code: "https://github.com/crahal/pysynthcon"
|
|
15
|
+
license: GPL-3.0-only
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Contributing to PySynthCon
|
|
2
|
+
|
|
3
|
+
Reference-method changes must preserve the full fitting specification: no
|
|
4
|
+
reduced restart counts, shortened lag histories, fixed predictor metrics, or
|
|
5
|
+
substituted tuning rules in replication examples. Run the independent original
|
|
6
|
+
R checks for affected methods using the separately supplied local bundle
|
|
7
|
+
described in [the reference setup guide](https://github.com/crahal/pysynthcon/blob/main/docs/reference_backends.md).
|
|
8
|
+
Install its pinned dependencies with
|
|
9
|
+
`python .local/reference/scripts/install_r_references.py --library .r-library`; R, a Fortran
|
|
10
|
+
compiler and GLPK development headers are required. Keep numerical recovery
|
|
11
|
+
diagnostics and distinguish algorithm parity from replication of a study's data
|
|
12
|
+
and covariate design. New figure benchmarks need a source, matched window,
|
|
13
|
+
statistic, units, and an explicit precision or approximation label.
|
|
14
|
+
|
|
15
|
+
Thank you for helping make synthetic control research easier to reproduce.
|
|
16
|
+
Report bugs or propose changes through the repository's GitHub issues and pull
|
|
17
|
+
requests. Include a minimal reproducible panel, versions, the complete error,
|
|
18
|
+
and the statistical specification. Do not upload confidential research data.
|
|
19
|
+
|
|
20
|
+
## Set up
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
python -m venv .venv
|
|
24
|
+
source .venv/bin/activate
|
|
25
|
+
python -m pip install -r requirements-replication.txt
|
|
26
|
+
python -m pip install -e '.[dev,docs]'
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Use the `src/` layout and the common `Panel -> Estimate` interface. Native
|
|
30
|
+
methods should remain usable without optional backends, plotting or R.
|
|
31
|
+
Keep input arrays immutable, preserve labels, return original outcome units,
|
|
32
|
+
and define the ATT and all preprocessing windows explicitly.
|
|
33
|
+
|
|
34
|
+
## Statistical changes
|
|
35
|
+
|
|
36
|
+
For an estimator change, cite a primary paper and an immutable reference
|
|
37
|
+
implementation where available. State the objective, constraints, penalty
|
|
38
|
+
normalization, intercept convention, tuning procedure and assumptions. Do not
|
|
39
|
+
rename a generic regression as an established method without matching its
|
|
40
|
+
design. Never use treated post outcomes for fitting weights or tuning.
|
|
41
|
+
Distinguish algorithms that legitimately use donor post outcomes, such as
|
|
42
|
+
SDID time weighting and robust-SCM denoising.
|
|
43
|
+
|
|
44
|
+
Add meaningful tests: an analytic case or independently generated reference,
|
|
45
|
+
label/order checks, convergence failures, and leakage checks. For empirical
|
|
46
|
+
replications, record exact sample/predictor windows, outcome units, pinned
|
|
47
|
+
data URLs, hashes and tolerances chosen from reference precision. Do not widen
|
|
48
|
+
a tolerance merely to make a failing result pass. Separate published values,
|
|
49
|
+
upstream numerical parity and a new empirical application.
|
|
50
|
+
|
|
51
|
+
Changes to the shared evaluation workflows must preserve fresh estimator
|
|
52
|
+
instances, identical folds, masked held-out treated outcomes, and complete
|
|
53
|
+
refits under the original fitting settings. Covariate wrappers must use the
|
|
54
|
+
received panel's training dates and eligible units. Keep every candidate's
|
|
55
|
+
diagnostics; never silently drop failed fits. Donor-sensitivity ranges are
|
|
56
|
+
descriptive, and selection scores do not supply post-selection inference.
|
|
57
|
+
|
|
58
|
+
## Validate a change
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
python -m ruff check src tests scripts
|
|
62
|
+
python -m ruff format --check src tests scripts
|
|
63
|
+
python -m pytest
|
|
64
|
+
python -m pytest -m network # for data/reference changes
|
|
65
|
+
python -m sphinx -W --keep-going -b html docs docs/_build/html
|
|
66
|
+
python -m build
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
`scripts/create_notebooks.py` regenerates the four empirical estimator comparisons
|
|
70
|
+
and clears their embedded outputs. Edit the study-specific inference example in
|
|
71
|
+
`empirical_examples/rhode_island.ipynb` and the simulation in
|
|
72
|
+
`simulated_examples/donor_spillovers.ipynb`. Run `scripts/execute_notebooks.py`
|
|
73
|
+
with the active Python interpreter to execute all six, or use
|
|
74
|
+
`--examples donor_spillovers` for the simulation alone. Use `--output-dir` to
|
|
75
|
+
write executed notebook copies to another directory. Standalone result exports
|
|
76
|
+
always go under the checkout's `outputs/`. Keep one notebook per study. Download
|
|
77
|
+
empirical inputs into memory and generate simulation inputs from a recorded
|
|
78
|
+
seed. Network-dependent tests carry the `network` marker.
|
|
79
|
+
|
|
80
|
+
Figure changes belong in the relevant plotting module,
|
|
81
|
+
with notebooks calling the public API. Preserve observed-minus-counterfactual
|
|
82
|
+
signs, actual calendar spacing, common comparison windows and explicit units.
|
|
83
|
+
Do not infer uncertainty from
|
|
84
|
+
variation across estimators. Test artist coordinates and summary values;
|
|
85
|
+
visually review the exported figures at their intended physical dimensions.
|
|
86
|
+
After changes, re-execute every affected notebook and inspect its PDF, SVG
|
|
87
|
+
and PNG exports under `outputs/empirical_examples/<study>/` or
|
|
88
|
+
`outputs/simulated_examples/<study>/`. PDF fonts must be
|
|
89
|
+
embedded, captions must fit the canvas, and common scales must retain
|
|
90
|
+
outlying methods. Commit the executed notebooks with embedded figures;
|
|
91
|
+
generated figure exports, CSVs and diagnostics remain local.
|
|
92
|
+
|
|
93
|
+
Keep R source and reference setup/validation utilities under ignored
|
|
94
|
+
`.local/reference/`. Do not embed R source in tracked Python files. The small
|
|
95
|
+
numerical JSON fixtures are regression-test inputs and remain tracked.
|
|
96
|
+
GitHub CI runs the Python checks and builds without uploading auxiliary
|
|
97
|
+
artifacts; original-R integration and complete notebook execution run locally
|
|
98
|
+
with the reference bundle provisioned.
|
|
99
|
+
|
|
100
|
+
## Pull requests and releases
|
|
101
|
+
|
|
102
|
+
Use focused commits with descriptive messages. Explain the concrete issue,
|
|
103
|
+
resulting behavior, verification and limitations in the PR. Update relevant
|
|
104
|
+
docs and `CHANGELOG.md`; add a citation when adding a method. Preserve the
|
|
105
|
+
repository's GPL-3.0 license and any third-party license notices. Do not copy
|
|
106
|
+
noncommercial-only source code into the library.
|
|
107
|
+
|
|
108
|
+
Before a release, validate both the core and optional backends, execute the
|
|
109
|
+
academic reference checks and notebooks in the pinned environment, build
|
|
110
|
+
documentation with warnings treated as errors, and inspect the wheel/sdist.
|
|
111
|
+
Keep the version in `pyproject.toml`, `pysynth.__version__`, docs and citation
|
|
112
|
+
metadata consistent. Publication to a package registry is a separate action.
|