Skip to content

Commit 86c0389

Browse files
committed
PR #457 R12 polish: correct fixture-3 inline comment in R generator
R12 verdict was Looks good with 1 P3 informational item: the fixture-3 inline comment in benchmarks/R/generate_bacon_golden.R still described the old contract — said R "natively groups first_treat=1 with U" (wrong; R keeps them as a distinct cohort and emits `Later vs Always Treated`) and said "30 never-treated" (wrong; the script builds 25 never-treated). The header docstring + meta.description template were updated in R11, but this inline block-comment slipped. Rewrote the inline comment to match: (a) the actual fixture construction (5 always-treated, 25 never-treated, 3 timing cohorts at times 3/4/5); (b) the correct R behavior (separate cohort, separate `Later vs Always Treated` rows); (c) pointers to REGISTRY note + deviation block; (d) what the parity tests carve out vs fold-back.
1 parent a202dca commit 86c0389

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

benchmarks/R/generate_bacon_golden.R

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,21 @@ df2 <- build_panel(
205205
fixture_2 <- extract_bacon(df2, "two_groups_no_never_treated")
206206

207207
cat("Building fixture 3: always_treated_remapped...\n")
208-
# 3 timing-cohorts + 5 always-treated units (first_treat = 1, i.e., treated
209-
# in every observable period) + 30 never-treated. R's bacondecomp natively
210-
# groups the first_treat=1 cohort with U (since they are treated throughout
211-
# every observable period and never serve as a within-window control), which
212-
# matches what diff-diff's warn+remap does in Python.
208+
# 3 timing-cohorts (3, 4, 5) + 5 always-treated units (first_treat = 1, i.e.,
209+
# treated in every observable period) + 25 never-treated. R's bacondecomp
210+
# keeps the first_treat=1 cohort as a *separate* timing cohort (not in U) and
211+
# emits a `Later vs Always Treated` comparison row for each later cohort
212+
# alongside the standard `Treated vs Untreated` row. Python's paper-footnote-11
213+
# convention remaps these units into the U bucket and folds R's two columns
214+
# of components into a single `treated_vs_never` cell per treated cohort.
215+
# The aggregate (TWFE coefficient + weights-sum) is invariant per Theorem 1,
216+
# but the per-component breakdown differs by convention — see REGISTRY
217+
# `**Note (R parity convention divergence on always-treated)**` and
218+
# `**Deviation (first-period boundary extension on always-treated remap)**`.
219+
# `tests/test_methodology_bacon.py::TestBaconParityR` carves out the U-bucket
220+
# rows for direct per-component parity (keeping the 6 timing-vs-timing rows
221+
# under direct parity) and asserts the U-bucket fold-back separately via
222+
# `test_always_treated_remapped_fold_back_matches_r` at atol=1e-6.
213223
df3 <- build_panel(
214224
n_units_per_cohort = 25L,
215225
n_periods = 6L,

0 commit comments

Comments
 (0)