Skip to content

Commit b7ccf33

Browse files
igerberclaude
andcommitted
Address CI codex R1 P3s on PR-A: API doc citation + test docstring framing
P3 (API doc citation drift): docs/api/chaisemartin_dhaultfoeuille.rst:116 still cited the dynamic companion as "(2022, revised 2024)"; the R1 cross-surface sweep missed this file. Aligns to "(2022, revised July 2023)" matching docs/references.rst, docs/methodology/REGISTRY.md, both paper-review headers, and both code docstrings. P3 (test docstring "paper-literal" framing): The regression test test_cell_count_weighting_unbalanced_input at tests/test_chaisemartin_dhaultfoeuille.py:828-850 still framed equal-cell weighting as "paper-literal" / "the correct behavior". This contradicts the updated REGISTRY:517 note and the new paper review (L76-L88, L278-L280) which transcribe Equation 3 of the AER 2020 paper as observation-sum weighting and document equal-cell as the library's deviation. Rewrites the docstring to describe equal-cell as the library's documented contract (deviation from both the paper and R), with explicit cross-links to REGISTRY and the paper review. Removes the "correct behavior" language. The test's actual assertions and DGP construction are unchanged - the test still pins the library's equal-cell contract; only the docstring narrative is corrected. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 6d98399 commit b7ccf33

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

docs/api/chaisemartin_dhaultfoeuille.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ library option for non-absorbing treatments.
113113
- de Chaisemartin, C. & D'Haultfœuille, X. (2020). Two-Way Fixed Effects
114114
Estimators with Heterogeneous Treatment Effects. *American Economic
115115
Review*, 110(9), 2964-2996.
116-
- de Chaisemartin, C. & D'Haultfœuille, X. (2022, revised 2024).
116+
- de Chaisemartin, C. & D'Haultfœuille, X. (2022, revised July 2023).
117117
Difference-in-Differences Estimators of Intertemporal Treatment
118118
Effects. NBER Working Paper 29873.
119119

tests/test_chaisemartin_dhaultfoeuille.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -827,27 +827,33 @@ def test_global_period_gap_treated_as_adjacent(self):
827827

828828
def test_cell_count_weighting_unbalanced_input(self):
829829
"""
830-
Regression test: dCDH must use cell counts (paper-literal),
831-
not within-cell observation counts, as the Theorem 3 N_{a,b,t}
832-
weights.
830+
Regression test: pins the library's documented equal-cell
831+
(cell-count) weighting contract for the Theorem 3 N_{a,b,t}
832+
weights. This is a documented deviation from both the AER 2020
833+
paper's Equation 3 (which uses observation-sum N_{g,t} weights)
834+
and from R DIDmultiplegtDYN's individual-row weighting; see
835+
docs/methodology/REGISTRY.md (## ChaisemartinDHaultfoeuille
836+
equal-cell deviation note) and the paper review at
837+
docs/methodology/papers/dechaisemartin-dhaultfoeuille-2020-review.md
838+
L76-L88 + L278-L280.
833839
834840
Constructed with two joiner groups whose (g, t) cells contain
835841
very different numbers of original observations (group 1 has
836842
100 obs/cell, group 2 has 1 obs/cell). Both joiners have the
837-
same true effect under the cell-weighted formula.
843+
same true effect under the library's cell-weighted formula.
838844
839-
Under cell weighting (paper-literal, the correct behavior),
840-
each cell contributes equally and the result equals the simple
841-
average of cell-level effects (~5.0). Under the bug behavior
842-
(sample-size weighting), group 1 dominates by 100x because its
843-
cells contribute 100x the weight.
845+
Under the library's cell weighting, each cell contributes
846+
equally and the result equals the simple average of cell-level
847+
effects (~5.0). Under sample-size weighting (the R / paper
848+
formula), group 1 would dominate by 100x because its cells
849+
contribute 100x the weight.
844850
845851
On a noiseless DGP both formulas would give 5.0; we add a
846-
deliberate per-cell perturbation to group 1 so that the bug
847-
would be visible: under sample-size weighting the result
848-
would shift toward group 1's cell mean (which is perturbed),
849-
while under cell weighting group 2's pristine effect would
850-
anchor the average.
852+
deliberate per-cell perturbation to group 1 so the deviation
853+
is visible: under sample-size weighting the result would shift
854+
toward group 1's cell mean (which is perturbed), while under
855+
the library's cell weighting group 2's pristine effect anchors
856+
the average.
851857
"""
852858
records = []
853859
# Group 1: 100 obs per cell, joiner at t=2, but with a +0.5

0 commit comments

Comments
 (0)