Repository navigation
Extend cd to mlsynth's feature set (PR B of 4) - #3
Merged
Merged
Conversation
tools/freeze_mlsynth_cd_reference.py runs mlsynth's SPILLSYNTH(method='cd') building blocks in a separate environment (mlsynth, cvxpy, CLARABEL) on: - the Cao-Dowd Proposition 99 panel: per-unit, homogeneous and distance-decay structures; - synthetic panels: two treated units, efficient weighting, structure selection. It writes benchmarks/reference/mlsynth_cd/reference.json, keyed by unit label, with a provenance block (mlsynth 1.0.0, solver versions, source SHA-256s). test_cd_mlsynth_parity.py compares scspill against it; a live comparison also runs when mlsynth is importable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Exposure structures: spillover_structure 'homogeneous' (Example 2, one shared spillover) and 'distance_decay' (Example 3, b * exp(-d_i) from unit_distances), next to 'per_unit' and 'custom'. - Several treated units with a common start date (Section S.1.2), each with its own direct effect; the headline is the first treated unit. - weighting='efficient': the Omega^-1-weighted estimator of Section S.1.1, reported alongside the headline fit, with a warning when T0 is too short to estimate Omega. - Pure-donor sensitivity (Section 5.2.2): bias weights of the spillover-aware and pure-donor estimators under missed spillovers, a 'sensitivity' plot, and the pure-donor weights as the cd comparator in the 'weights' plot. - Structure selection by kappa_A (Sections 5.1.2 and S.1.3), reusing the fit's SCM equations. The default statistic is the paper's multi-period kappa_A; statistic='mean_norm' is mlsynth's. Invariant tests check that equal distances reproduce the homogeneous structure, that one affected unit is the same per-unit or homogeneous, that W = I recovers the unweighted estimator, and that the headline choice does not move the effects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stacked on #2. Once that merges, this PR retargets to
main. It adds the Cao & Dowd features that mlsynth'sSPILLSYNTH(method="cd")has and the mergedcdmodel lacked. Each feature follows the paper's v3 definitions and is cross-checked against mlsynth.spillover_structure="homogeneous"withaffected_unitsspillover_structure="distance_decay"withunit_distancestreatcolumn;att_by_unitweighting="efficient", which fillsresult.cd.efficientresult.cd.sensitivity; plot kind"sensitivity"result.select_structure_by_kappa(candidates)Two choices worth a look:
statistic="mean_norm", and the parity test uses it.Validation
tools/freeze_mlsynth_cd_reference.pyruns mlsynth 1.0.0 (cvxpy/CLARABEL) in a separate environment and writesbenchmarks/reference/mlsynth_cd/reference.json. The README there records provenance and SHA-256s.test_cd_mlsynth_parity.pychecks six cases plus structure selection. Coverage:test_cd_features.pychecks:sarstill rejects two treated units.make lint typecheck test: 306 passed, 3 skipped. Slow tests pass.🤖 Generated with Claude Code