diff-diff 3.4.0__tar.gz → 3.4.1__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.
- {diff_diff-3.4.0 → diff_diff-3.4.1}/PKG-INFO +2 -2
- {diff_diff-3.4.0 → diff_diff-3.4.1}/README.md +1 -1
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/__init__.py +1 -1
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/estimators.py +7 -2
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/guides/llms-full.txt +3 -2
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/guides/llms.txt +1 -5
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/had.py +63 -7
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/had_pretests.py +68 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/linalg.py +531 -130
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/results.py +9 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/spillover.py +477 -53
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/sun_abraham.py +452 -45
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/survey.py +195 -4
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/twfe.py +179 -88
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/two_stage.py +890 -33
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/utils.py +113 -50
- {diff_diff-3.4.0 → diff_diff-3.4.1}/pyproject.toml +1 -1
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/Cargo.lock +3 -3
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/Cargo.toml +1 -1
- {diff_diff-3.4.0 → diff_diff-3.4.1}/LICENSE +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/_backend.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/_guides_api.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/_nprobust_port.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/_reporting_helpers.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/agent_workflow.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/bacon.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/bootstrap_utils.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/business_report.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/chaisemartin_dhaultfoeuille.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/chaisemartin_dhaultfoeuille_bootstrap.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/chaisemartin_dhaultfoeuille_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/conley.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/continuous_did.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/continuous_did_bspline.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/continuous_did_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/datasets.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/diagnostic_report.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/diagnostics.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/efficient_did.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/efficient_did_bootstrap.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/efficient_did_covariates.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/efficient_did_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/efficient_did_weights.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/guides/__init__.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/guides/llms-autonomous.txt +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/guides/llms-practitioner.txt +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/honest_did.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/imputation.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/imputation_bootstrap.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/imputation_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/local_linear.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/power.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/practitioner.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/prep.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/prep_dgp.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/pretrends.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/profile.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/stacked_did.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/stacked_did_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/staggered.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/staggered_aggregation.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/staggered_bootstrap.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/staggered_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/staggered_triple_diff.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/staggered_triple_diff_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/synthetic_did.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/triple_diff.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/trop.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/trop_global.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/trop_local.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/trop_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/two_stage_bootstrap.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/two_stage_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/__init__.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_common.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_continuous.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_diagnostic.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_event_study.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_power.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_staggered.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/visualization/_synthetic.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/wooldridge.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/diff_diff/wooldridge_results.py +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/build.rs +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/src/bootstrap.rs +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/src/lib.rs +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/src/linalg.rs +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/src/trop.rs +0 -0
- {diff_diff-3.4.0 → diff_diff-3.4.1}/rust/src/weights.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diff-diff
|
|
3
|
-
Version: 3.4.
|
|
3
|
+
Version: 3.4.1
|
|
4
4
|
Classifier: Development Status :: 5 - Production/Stable
|
|
5
5
|
Classifier: Intended Audience :: Science/Research
|
|
6
6
|
Classifier: Operating System :: OS Independent
|
|
@@ -159,7 +159,7 @@ Full guide: `diff_diff.get_llm_guide("practitioner")`.
|
|
|
159
159
|
- [SunAbraham](https://diff-diff.readthedocs.io/en/stable/api/staggered.html) - Sun & Abraham (2021) interaction-weighted estimator for heterogeneity-robust event studies
|
|
160
160
|
- [ImputationDiD](https://diff-diff.readthedocs.io/en/stable/api/imputation.html) - Borusyak, Jaravel & Spiess (2024) imputation estimator, most efficient under homogeneous effects
|
|
161
161
|
- [TwoStageDiD](https://diff-diff.readthedocs.io/en/stable/api/two_stage.html) - Gardner (2022) two-stage estimator with GMM sandwich variance
|
|
162
|
-
- [SpilloverDiD](https://diff-diff.readthedocs.io/en/stable/api/spillover.html) - Butts (2021) ring-indicator spillover-aware DiD identifying direct effect on treated + per-ring spillover on near-control units; handles non-staggered and staggered timing
|
|
162
|
+
- [SpilloverDiD](https://diff-diff.readthedocs.io/en/stable/api/spillover.html) - Butts (2021) ring-indicator spillover-aware DiD identifying direct effect on treated + per-ring spillover on near-control units; handles non-staggered and staggered timing; supports survey-design variance under `survey_design=` for HC1 / CR1 (Wave E.1 Binder TSL) and Conley (Wave E.2 panel-aware stratified-Conley sandwich on per-period PSU totals; extended in Wave E.2 follow-up to `conley_lag_cutoff > 0` via panel-block composition with within-PSU serial Bartlett HAC — `lag>0` requires an effective PSU via explicit `survey_design.psu` or injected `cluster=<col>`)
|
|
163
163
|
- [SyntheticDiD](https://diff-diff.readthedocs.io/en/stable/api/estimators.html) - Synthetic DiD combining standard DiD and synthetic control for few treated units
|
|
164
164
|
- [TripleDifference](https://diff-diff.readthedocs.io/en/stable/api/triple_diff.html) - triple difference (DDD) estimator for designs requiring two criteria for treatment eligibility
|
|
165
165
|
- [ContinuousDiD](https://diff-diff.readthedocs.io/en/stable/api/continuous_did.html) - Callaway, Goodman-Bacon & Sant'Anna (2024) continuous treatment DiD with dose-response curves
|
|
@@ -106,7 +106,7 @@ Full guide: `diff_diff.get_llm_guide("practitioner")`.
|
|
|
106
106
|
- [SunAbraham](https://diff-diff.readthedocs.io/en/stable/api/staggered.html) - Sun & Abraham (2021) interaction-weighted estimator for heterogeneity-robust event studies
|
|
107
107
|
- [ImputationDiD](https://diff-diff.readthedocs.io/en/stable/api/imputation.html) - Borusyak, Jaravel & Spiess (2024) imputation estimator, most efficient under homogeneous effects
|
|
108
108
|
- [TwoStageDiD](https://diff-diff.readthedocs.io/en/stable/api/two_stage.html) - Gardner (2022) two-stage estimator with GMM sandwich variance
|
|
109
|
-
- [SpilloverDiD](https://diff-diff.readthedocs.io/en/stable/api/spillover.html) - Butts (2021) ring-indicator spillover-aware DiD identifying direct effect on treated + per-ring spillover on near-control units; handles non-staggered and staggered timing
|
|
109
|
+
- [SpilloverDiD](https://diff-diff.readthedocs.io/en/stable/api/spillover.html) - Butts (2021) ring-indicator spillover-aware DiD identifying direct effect on treated + per-ring spillover on near-control units; handles non-staggered and staggered timing; supports survey-design variance under `survey_design=` for HC1 / CR1 (Wave E.1 Binder TSL) and Conley (Wave E.2 panel-aware stratified-Conley sandwich on per-period PSU totals; extended in Wave E.2 follow-up to `conley_lag_cutoff > 0` via panel-block composition with within-PSU serial Bartlett HAC — `lag>0` requires an effective PSU via explicit `survey_design.psu` or injected `cluster=<col>`)
|
|
110
110
|
- [SyntheticDiD](https://diff-diff.readthedocs.io/en/stable/api/estimators.html) - Synthetic DiD combining standard DiD and synthetic control for few treated units
|
|
111
111
|
- [TripleDifference](https://diff-diff.readthedocs.io/en/stable/api/triple_diff.html) - triple difference (DDD) estimator for designs requiring two criteria for treatment eligibility
|
|
112
112
|
- [ContinuousDiD](https://diff-diff.readthedocs.io/en/stable/api/continuous_did.html) - Callaway, Goodman-Bacon & Sant'Anna (2024) continuous treatment DiD with dose-response curves
|
|
@@ -1891,8 +1891,13 @@ class MultiPeriodDiD(DifferenceInDifferences):
|
|
|
1891
1891
|
else:
|
|
1892
1892
|
# Cluster-aware CR2 BM Satterthwaite DOF for per-coefficient
|
|
1893
1893
|
# AND post-period-average compound contrast (Gate 6 lift).
|
|
1894
|
-
#
|
|
1895
|
-
#
|
|
1894
|
+
# This branch is guarded above by `not _use_survey_vcov`,
|
|
1895
|
+
# so when reached, `survey_weights` is None (survey designs
|
|
1896
|
+
# always route through the TSL path). The clubSandwich
|
|
1897
|
+
# WLS-CR2 port lifted `_compute_cr2_bm_contrast_dof` to
|
|
1898
|
+
# accept `weights=`, but no MPD entry point currently
|
|
1899
|
+
# passes non-None weights here — `weights=None` is the
|
|
1900
|
+
# de facto contract on this code path today.
|
|
1896
1901
|
_dof_all = _compute_cr2_bm_contrast_dof(
|
|
1897
1902
|
X_kept,
|
|
1898
1903
|
effective_cluster_ids,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> A Python library for Difference-in-Differences causal inference analysis. Provides sklearn-like estimators with statsmodels-style output for econometric analysis.
|
|
4
4
|
|
|
5
|
-
- Version: 3.4.
|
|
5
|
+
- Version: 3.4.1
|
|
6
6
|
- Repository: https://github.com/igerber/diff-diff
|
|
7
7
|
- License: MIT
|
|
8
8
|
- Dependencies: numpy, pandas, scipy (no statsmodels dependency)
|
|
@@ -335,10 +335,11 @@ SunAbraham(
|
|
|
335
335
|
control_group: str = "never_treated", # "never_treated" or "not_yet_treated"
|
|
336
336
|
anticipation: int = 0,
|
|
337
337
|
alpha: float = 0.05,
|
|
338
|
-
cluster: str | None = None, # Defaults to unit-level clustering
|
|
338
|
+
cluster: str | None = None, # Defaults to unit-level clustering (dropped on explicit vcov_type='hc2' / 'classical')
|
|
339
339
|
n_bootstrap: int = 0, # 0 = analytical cluster-robust SEs
|
|
340
340
|
seed: int | None = None,
|
|
341
341
|
rank_deficient_action: str = "warn",
|
|
342
|
+
vcov_type: str = "hc1", # {"classical","hc1","hc2","hc2_bm"}; classical/hc2/hc2_bm route through full-dummy saturated design. survey_design=... is rejected for classical/hc2/hc2_bm (use hc1 default for surveys)
|
|
342
343
|
)
|
|
343
344
|
```
|
|
344
345
|
|
|
@@ -10,10 +10,6 @@ diff-diff offers 17 estimators covering basic 2x2 DiD, modern staggered adoption
|
|
|
10
10
|
- Source: https://github.com/igerber/diff-diff
|
|
11
11
|
- Docs: https://diff-diff.readthedocs.io/en/stable/
|
|
12
12
|
|
|
13
|
-
## Agent Quickstart
|
|
14
|
-
|
|
15
|
-
LLM agents: call `diff_diff.agent_workflow(df, unit=..., time=..., treatment=..., outcome=...)` first. It prints the recommended 5-step workflow (`profile_panel` → `get_llm_guide` → `<Estimator>().fit` → `practitioner_next_steps` → `BusinessReport`) with your column names wired in.
|
|
16
|
-
|
|
17
13
|
## Practitioner Workflow (based on Baker et al. 2025)
|
|
18
14
|
|
|
19
15
|
IMPORTANT: For rigorous DiD analysis, follow these 8 steps. Skipping
|
|
@@ -62,7 +58,7 @@ Full practitioner guide: call `diff_diff.get_llm_guide("practitioner")`
|
|
|
62
58
|
- [SunAbraham](https://diff-diff.readthedocs.io/en/stable/api/staggered.html): Sun & Abraham (2021) interaction-weighted estimator for heterogeneity-robust event studies
|
|
63
59
|
- [ImputationDiD](https://diff-diff.readthedocs.io/en/stable/api/imputation.html): Borusyak, Jaravel & Spiess (2024) imputation estimator — most efficient under homogeneous effects
|
|
64
60
|
- [TwoStageDiD](https://diff-diff.readthedocs.io/en/stable/api/two_stage.html): Gardner (2022) two-stage estimator with GMM sandwich variance
|
|
65
|
-
- [SpilloverDiD](https://diff-diff.readthedocs.io/en/stable/api/spillover.html): Butts (2021) ring-indicator spillover-aware DiD identifying direct effect on treated + per-ring spillover-on-control; reuses `conley_coords` for ring construction; handles non-staggered and staggered timing
|
|
61
|
+
- [SpilloverDiD](https://diff-diff.readthedocs.io/en/stable/api/spillover.html): Butts (2021) ring-indicator spillover-aware DiD identifying direct effect on treated + per-ring spillover-on-control; reuses `conley_coords` for ring construction; handles non-staggered and staggered timing; supports `SurveyDesign(weights, strata, psu, fpc)` under `vcov_type="hc1"` with optional `cluster=<col>` for CR1 via Gerber (2026) Binder TSL (Wave E.1) and under `vcov_type="conley"` via a panel-aware stratified-Conley sandwich on per-period PSU totals (Wave E.2 cross-sectional `conley_lag_cutoff=0`) extended in Wave E.2 follow-up to `conley_lag_cutoff > 0` via panel-block composition with within-PSU serial Bartlett HAC (Newey-West 1987 separable form; `lag>0` requires an effective PSU via explicit `survey_design.psu` or injected `cluster=<col>`), both composed with the Wave D Gardner GMM correction (replicate weights queued as follow-up)
|
|
66
62
|
- [SyntheticDiD](https://diff-diff.readthedocs.io/en/stable/api/estimators.html): Synthetic DiD combining standard DiD and synthetic control methods for few treated units
|
|
67
63
|
- [TripleDifference](https://diff-diff.readthedocs.io/en/stable/api/triple_diff.html): Triple difference (DDD) estimator for designs requiring two criteria for treatment eligibility
|
|
68
64
|
- [ContinuousDiD](https://diff-diff.readthedocs.io/en/stable/api/continuous_did.html): Callaway, Goodman-Bacon & Sant'Anna (2024) continuous treatment DiD with dose-response curves
|
|
@@ -2595,6 +2595,50 @@ class HeterogeneousAdoptionDiD:
|
|
|
2595
2595
|
|
|
2596
2596
|
Notes
|
|
2597
2597
|
-----
|
|
2598
|
+
**Non-testable assumptions (paper Section 3.1.2).** Point identification
|
|
2599
|
+
of ``WAS_{d_lower}`` on the Design 1 family
|
|
2600
|
+
(``continuous_near_d_lower`` and ``mass_point``) requires Assumption 6
|
|
2601
|
+
in addition to parallel trends; sign identification requires
|
|
2602
|
+
Assumption 5. Neither is testable via pre-trends:
|
|
2603
|
+
|
|
2604
|
+
- Assumption 5 (sign identification): the boundary slope-ratio
|
|
2605
|
+
``lim_{d down d_lower} E(TE_2 | D_2 <= d) / WAS < E(D_2) / d_lower``
|
|
2606
|
+
relates the conditional expectation near the boundary to the
|
|
2607
|
+
overall WAS; it cannot be inferred from pre-period outcome
|
|
2608
|
+
trajectories alone.
|
|
2609
|
+
- Assumption 6 (point identification): the counterfactual-mean
|
|
2610
|
+
alignment ``lim_{d down d_lower} E[Y_2(d_lower) - Y_2(0) | D_2 <= d]
|
|
2611
|
+
= E[Y_2(d_lower) - Y_2(0)]`` is a statement about an unobserved
|
|
2612
|
+
counterfactual at the support infimum.
|
|
2613
|
+
|
|
2614
|
+
The fit() method emits a ``UserWarning`` whenever ``resolved_design``
|
|
2615
|
+
is on the Design 1 family (``continuous_near_d_lower`` or
|
|
2616
|
+
``mass_point``) so users are not silently led to interpret point
|
|
2617
|
+
estimates as full point identification. The available pre-tests
|
|
2618
|
+
verify ADJACENT identifying conditions:
|
|
2619
|
+
|
|
2620
|
+
- :func:`diff_diff.qug_test`: Theorem 4 / Design 1' support-infimum
|
|
2621
|
+
null ``d_lower = 0`` (adjacent evidence on the ``d_lower = 0``
|
|
2622
|
+
clause of Assumption 4 only, NOT a test of the full Assumption 4
|
|
2623
|
+
statement which also covers boundary-density positivity,
|
|
2624
|
+
conditional-mean smoothness, conditional-variance regularity, and
|
|
2625
|
+
bandwidth conditions).
|
|
2626
|
+
- :func:`diff_diff.stute_test` / :func:`diff_diff.yatchew_hr_test`:
|
|
2627
|
+
Assumption 8 linearity of ``E[ΔY | D_2]`` in ``D_2`` (residuals
|
|
2628
|
+
from ``dy ~ 1 + d``).
|
|
2629
|
+
- :func:`diff_diff.joint_pretrends_test`: Assumption 7
|
|
2630
|
+
mean-independence pre-trends across multi-period placebos
|
|
2631
|
+
(intercept-only residual form via ``null_form="mean_independence"``;
|
|
2632
|
+
the raw ``stute_test`` / ``yatchew_hr_test`` helpers do NOT cover
|
|
2633
|
+
Assumption 7 on their own).
|
|
2634
|
+
|
|
2635
|
+
None of these test Assumptions 5 or 6 directly. The Assumption 5/6
|
|
2636
|
+
non-testability caveat is surfaced by the Design 1 fit-time
|
|
2637
|
+
``UserWarning`` and by T21 (HAD pretest workflow tutorial) prose,
|
|
2638
|
+
NOT by the composite workflow verdict string (which only flags the
|
|
2639
|
+
Assumption 7 step-2 gap on the two-period ``aggregate="overall"``
|
|
2640
|
+
path).
|
|
2641
|
+
|
|
2598
2642
|
**Diagnostics coverage.** ``HeterogeneousAdoptionDiDResults.bandwidth_diagnostics``
|
|
2599
2643
|
and ``.bias_corrected_fit`` are populated only on the continuous
|
|
2600
2644
|
paths; both are ``None`` on the mass-point path (which is parametric
|
|
@@ -2831,13 +2875,22 @@ class HeterogeneousAdoptionDiD:
|
|
|
2831
2875
|
first_treat_col : str or None
|
|
2832
2876
|
Optional first-treatment column (the period at which each
|
|
2833
2877
|
unit first receives treatment; ``0`` for never-treated).
|
|
2834
|
-
Required on the event-study path when the panel has more
|
|
2835
|
-
than two distinct first-treat values (staggered timing):
|
|
2836
|
-
the estimator auto-filters to the last-treatment cohort
|
|
2837
|
-
with a ``UserWarning`` per paper Appendix B.2 prescription.
|
|
2838
2878
|
For common-adoption panels the column is optional; when
|
|
2839
2879
|
omitted, the event-study path infers the first-treatment
|
|
2840
|
-
period ``F`` from the dose invariant.
|
|
2880
|
+
period ``F`` from the dose invariant. **Staggered-timing
|
|
2881
|
+
contract (HAD Appendix B.2):**
|
|
2882
|
+
|
|
2883
|
+
- **`first_treat_col` supplied + multiple cohorts detected**:
|
|
2884
|
+
auto-filter to the last-treatment cohort + never-treated
|
|
2885
|
+
units with a ``UserWarning`` naming kept / dropped counts.
|
|
2886
|
+
- **`first_treat_col` omitted + multiple distinct first-
|
|
2887
|
+
positive-dose cohorts inferred from the dose path**: the
|
|
2888
|
+
estimator FAIL-CLOSES with ``ValueError`` directing the
|
|
2889
|
+
user to either pass ``first_treat_col`` (activates the
|
|
2890
|
+
auto-filter) or use :class:`ChaisemartinDHaultfoeuille`
|
|
2891
|
+
(``did_multiplegt_dyn``) for full staggered support. See
|
|
2892
|
+
REGISTRY § "Library extension: Staggered-timing fail-
|
|
2893
|
+
closed" for the rationale on raising vs. warning.
|
|
2841
2894
|
aggregate : {"overall", "event_study"}
|
|
2842
2895
|
``"overall"`` (default): returns a single-period
|
|
2843
2896
|
:class:`HeterogeneousAdoptionDiDResults` (Phase 2a). Requires
|
|
@@ -2847,8 +2900,11 @@ class HeterogeneousAdoptionDiD:
|
|
|
2847
2900
|
event-time WAS estimates on the multi-period panel (paper
|
|
2848
2901
|
Appendix B.2). Requires more than two time periods. Pointwise
|
|
2849
2902
|
CIs per horizon; joint cross-horizon covariance is deferred
|
|
2850
|
-
to a follow-up PR. Staggered-timing panels
|
|
2851
|
-
|
|
2903
|
+
to a follow-up PR. Staggered-timing panels: see the
|
|
2904
|
+
``first_treat_col`` contract above (auto-filter to last
|
|
2905
|
+
cohort + never-treated with ``UserWarning`` when supplied;
|
|
2906
|
+
fail-closed ``ValueError`` when omitted on a staggered
|
|
2907
|
+
panel).
|
|
2852
2908
|
survey_design : SurveyDesign or None, keyword-only
|
|
2853
2909
|
Survey design (sampling weights + optional strata / PSU / FPC)
|
|
2854
2910
|
for design-based inference. Supported on ALL design × aggregate
|
|
@@ -1349,6 +1349,22 @@ def qug_test(
|
|
|
1349
1349
|
|
|
1350
1350
|
Notes
|
|
1351
1351
|
-----
|
|
1352
|
+
**Scope (what this test does NOT cover).** ``qug_test`` tests the
|
|
1353
|
+
Theorem 4 / Design 1' support-infimum null ``H_0: d_lower = 0``. It
|
|
1354
|
+
does not validate the full Assumption 4 (Assumption 4 also requires
|
|
1355
|
+
positive boundary density, twice-differentiable conditional-mean,
|
|
1356
|
+
bounded continuous conditional-variance, and bandwidth regularity —
|
|
1357
|
+
QUG is adjacent evidence on the ``d_lower = 0`` clause only). It
|
|
1358
|
+
does NOT and CANNOT test Assumptions 5 and 6 from the same paper
|
|
1359
|
+
(Section 3.1.2), which are required for sign identification (A5) and
|
|
1360
|
+
point identification (A6) of ``WAS_{d_lower}`` on the Design 1 family
|
|
1361
|
+
(``d_lower > 0``). Assumptions 5 and 6 are statements about
|
|
1362
|
+
conditional expectations near the support boundary and about
|
|
1363
|
+
counterfactual-mean alignment respectively; they are non-testable via
|
|
1364
|
+
pre-trends. See :class:`HeterogeneousAdoptionDiD` class docstring
|
|
1365
|
+
Notes for the full statement and T21 (HAD pretest workflow tutorial)
|
|
1366
|
+
for the verdict-language convention that surfaces this gap.
|
|
1367
|
+
|
|
1352
1368
|
Tie-break: when ``D_{(1)} == D_{(2)}`` the statistic is undefined.
|
|
1353
1369
|
The test returns ``t_stat=NaN, p_value=NaN, reject=False`` with a
|
|
1354
1370
|
``UserWarning`` rather than raising.
|
|
@@ -1636,6 +1652,23 @@ def stute_test(
|
|
|
1636
1652
|
|
|
1637
1653
|
Notes
|
|
1638
1654
|
-----
|
|
1655
|
+
**Scope (what this test does NOT cover).** ``stute_test`` targets
|
|
1656
|
+
paper Assumption 8 (linearity of ``E[ΔY | D_2]`` in ``D_2``) — the
|
|
1657
|
+
raw helper always fits ``dy ~ 1 + d`` and tests the linearity null;
|
|
1658
|
+
it does NOT target Assumption 7 mean-independence pre-trends on its
|
|
1659
|
+
own. For Assumption 7 mean-independence (residuals from intercept-
|
|
1660
|
+
only ``dy ~ 1``), use :func:`joint_pretrends_test` (which routes
|
|
1661
|
+
``null_form="mean_independence"`` into the joint CvM core). It does
|
|
1662
|
+
NOT and CANNOT test Assumptions 5 and 6 from de Chaisemartin et al.
|
|
1663
|
+
(2026) Section 3.1.2, which are required for sign / point
|
|
1664
|
+
identification of ``WAS_{d_lower}`` on the Design 1 family
|
|
1665
|
+
(``d_lower > 0``). Assumptions 5/6 are non-testable via pre-trends
|
|
1666
|
+
(boundary-conditional expectations and counterfactual-mean alignment
|
|
1667
|
+
statements); they are surfaced by the Design 1 fit-time
|
|
1668
|
+
``UserWarning`` and by T21 tutorial prose, NOT by the workflow
|
|
1669
|
+
verdict string. See :class:`HeterogeneousAdoptionDiD` class
|
|
1670
|
+
docstring Notes for the full statement.
|
|
1671
|
+
|
|
1639
1672
|
Sample-size gate: below ``G = 10`` the CvM statistic is not
|
|
1640
1673
|
well-calibrated. In that case the function emits ``UserWarning`` and
|
|
1641
1674
|
returns all-NaN inference rather than raising.
|
|
@@ -2112,6 +2145,20 @@ def yatchew_hr_test(
|
|
|
2112
2145
|
|
|
2113
2146
|
Notes
|
|
2114
2147
|
-----
|
|
2148
|
+
**Scope (what this test does NOT cover).** ``yatchew_hr_test`` targets
|
|
2149
|
+
paper Assumption 8 (linearity of ``E[ΔY | D_2]`` in ``D_2``) under
|
|
2150
|
+
``null="linearity"`` (default); ``null="mean_independence"`` swaps
|
|
2151
|
+
the residual definition to intercept-only ``dy ~ 1`` for R parity
|
|
2152
|
+
with ``YatchewTest::yatchew_test(order=0)`` on pre-trend placebos.
|
|
2153
|
+
It does NOT and CANNOT test Assumptions 5 and 6 from de
|
|
2154
|
+
Chaisemartin et al. (2026) Section 3.1.2, which are required for
|
|
2155
|
+
sign / point identification of ``WAS_{d_lower}`` on the Design 1
|
|
2156
|
+
family (``d_lower > 0``). Assumptions 5/6 are non-testable via
|
|
2157
|
+
pre-trends; they are surfaced by the Design 1 fit-time
|
|
2158
|
+
``UserWarning`` and by T21 tutorial prose, NOT by the workflow
|
|
2159
|
+
verdict string. See :class:`HeterogeneousAdoptionDiD` class
|
|
2160
|
+
docstring Notes for the full statement.
|
|
2161
|
+
|
|
2115
2162
|
Sample-size gate: below ``G = 3`` the difference-variance estimator
|
|
2116
2163
|
is undefined; the function emits ``UserWarning`` and returns NaN
|
|
2117
2164
|
rather than raising.
|
|
@@ -4548,6 +4595,27 @@ def did_had_pretest_workflow(
|
|
|
4548
4595
|
|
|
4549
4596
|
Notes
|
|
4550
4597
|
-----
|
|
4598
|
+
**Scope (what this composite workflow does NOT cover).** The
|
|
4599
|
+
component pretests target the Theorem 4 / Design 1' support-infimum
|
|
4600
|
+
null (QUG: ``d_lower = 0``, adjacent evidence on the ``d_lower = 0``
|
|
4601
|
+
clause of Assumption 4 only — does not validate boundary density,
|
|
4602
|
+
conditional-mean smoothness, or variance regularity), Assumption 7
|
|
4603
|
+
(joint Stute pre-trends: mean-independence of placebo first-
|
|
4604
|
+
differences from dose), and Assumption 8 (Yatchew / joint
|
|
4605
|
+
homogeneity: linearity of treatment effects in dose). The workflow
|
|
4606
|
+
does NOT and CANNOT test Assumptions 5 and 6
|
|
4607
|
+
from de Chaisemartin et al. (2026) Section 3.1.2, which are required
|
|
4608
|
+
for sign / point identification of ``WAS_{d_lower}`` on the Design 1
|
|
4609
|
+
family (``d_lower > 0``). Assumptions 5/6 are non-testable via
|
|
4610
|
+
pre-trends. The composite verdict string does NOT mention
|
|
4611
|
+
Assumptions 5 or 6 — it only flags the Assumption 7 step-2 gap on
|
|
4612
|
+
the two-period ``aggregate="overall"`` path. The Assumption 5/6
|
|
4613
|
+
caveat is surfaced separately by (a) the
|
|
4614
|
+
``HeterogeneousAdoptionDiD.fit()`` fit-time ``UserWarning`` (which
|
|
4615
|
+
fires whenever the resolved design is Design 1 family —
|
|
4616
|
+
``continuous_near_d_lower`` or ``mass_point``) and (b) T21 (HAD
|
|
4617
|
+
pretest workflow tutorial) tutorial prose.
|
|
4618
|
+
|
|
4551
4619
|
Survey/weighted data (Phase 4.5 C): under ``survey=`` or ``weights=``,
|
|
4552
4620
|
the workflow:
|
|
4553
4621
|
|