|
9 | 9 | :func:`diff_diff.utils.safe_inference`. |
10 | 10 |
|
11 | 11 | 1. Design 1' (``continuous_at_zero``): ``d_lower = 0``, boundary density |
12 | | - continuous at zero, Assumption 3. Equation 7 / Theorem 3: |
| 12 | + continuous at zero, Assumption 3. Theorem 1 / Equation 3 |
| 13 | + (identification); Equation 7 (sample estimator): |
13 | 14 |
|
14 | 15 | beta = (E[Delta Y] - lim_{d v 0} E[Delta Y | D_2 <= d]) / E[D_2] |
15 | 16 |
|
|
19 | 20 |
|
20 | 21 | 2. Design 1 continuous-near-d_lower (``continuous_near_d_lower``): |
21 | 22 | ``d_lower > 0``, continuous boundary density, Assumption 5 or 6. |
22 | | - Proposition 3 / Theorem 4 (``WAS_{d_lower}`` under Assumption 6): |
| 23 | + Theorem 3 / Equation 11 (``WAS_{d_lower}`` under Assumption 6; |
| 24 | + Theorem 4 is the QUG null test, not this estimand): |
23 | 25 |
|
24 | 26 | beta = (E[Delta Y] - lim_{d v d_lower} E[Delta Y | D_2 <= d]) |
25 | 27 | / E[D_2 - d_lower] |
@@ -135,13 +137,14 @@ class HeterogeneousAdoptionDiDResults: |
135 | 137 | att : float |
136 | 138 | Point estimate of the WAS parameter on the beta-scale. |
137 | 139 |
|
138 | | - - Design 1' (paper Equation 7 / Theorem 3): |
| 140 | + - Design 1' (paper Theorem 1 / Equation 3 identification; |
| 141 | + Equation 7 sample estimator): |
139 | 142 | ``att = (mean(ΔY) - tau_bc) / D_bar`` |
140 | 143 | where ``tau_bc`` is the bias-corrected local-linear estimate |
141 | 144 | of ``lim_{d v 0} E[ΔY | D_2 <= d]`` and |
142 | 145 | ``D_bar = (1/G) * sum(D_{g,2})``. |
143 | | - - Design 1 continuous-near-d_lower (paper Theorem 4, |
144 | | - ``WAS_{d_lower}`` under Assumption 6): |
| 146 | + - Design 1 continuous-near-d_lower (paper Theorem 3 / |
| 147 | + Equation 11, ``WAS_{d_lower}`` under Assumption 6): |
145 | 148 | ``att = (mean(ΔY) - tau_bc) / mean(D_2 - d_lower)`` |
146 | 149 | where ``tau_bc`` is the bias-corrected local-linear estimate |
147 | 150 | of ``lim_{d v d_lower} E[ΔY | D_2 <= d]``. |
@@ -1006,6 +1009,17 @@ def fit( |
1006 | 1009 | ) -> HeterogeneousAdoptionDiDResults: |
1007 | 1010 | """Fit the HAD estimator on a two-period panel. |
1008 | 1011 |
|
| 1012 | + Phase 2a is **panel-only**: the paper (Section 2) defines HAD on |
| 1013 | + panel or repeated-cross-section data, but this implementation |
| 1014 | + requires a balanced two-period panel with a unit identifier so |
| 1015 | + that unit-level first differences ``ΔY_g = Y_{g,2} - Y_{g,1}`` |
| 1016 | + can be formed. Repeated-cross-section inputs (disjoint unit IDs |
| 1017 | + between periods) are rejected by the balanced-panel validator. |
| 1018 | + Repeated-cross-section support is queued for a follow-up PR |
| 1019 | + (tracked in ``TODO.md``); it requires a separate identification |
| 1020 | + path based on pre/post cell means rather than unit-level |
| 1021 | + differences. |
| 1022 | +
|
1009 | 1023 | Parameters |
1010 | 1024 | ---------- |
1011 | 1025 | data : pd.DataFrame |
@@ -1337,16 +1351,17 @@ def _fit_continuous( |
1337 | 1351 | Implements de Chaisemartin, Ciccia, D'Haultfoeuille, and Knau |
1338 | 1352 | (2026) continuous-design estimators: |
1339 | 1353 |
|
1340 | | - - Design 1' (``continuous_at_zero``), paper Equation 7 / |
1341 | | - Theorem 3: |
| 1354 | + - Design 1' (``continuous_at_zero``), paper Theorem 1 / |
| 1355 | + Equation 3 (identification); Equation 7 (sample estimator): |
1342 | 1356 |
|
1343 | 1357 | beta = (E[Delta Y] - lim_{d v 0} E[Delta Y | D_2 <= d]) / E[D_2] |
1344 | 1358 |
|
1345 | 1359 | Regressor passed to the local-linear boundary fit is |
1346 | 1360 | ``d_arr``; the boundary is ``0``. |
1347 | 1361 |
|
1348 | | - - Design 1 (``continuous_near_d_lower``), paper Proposition 3 / |
1349 | | - Theorem 4 (``WAS_{d_lower}`` under Assumption 6): |
| 1362 | + - Design 1 (``continuous_near_d_lower``), paper Theorem 3 / |
| 1363 | + Equation 11 (``WAS_{d_lower}`` under Assumption 6; note |
| 1364 | + Theorem 4 is the QUG null test, not this estimand): |
1350 | 1365 |
|
1351 | 1366 | beta = (E[Delta Y] - lim_{d v d_lower} E[Delta Y | D_2 <= d]) |
1352 | 1367 | / E[D_2 - d_lower] |
|
0 commit comments