PowerAnalysis methodology review (PR-B): Burlig Eq.2 equicorrelated panel variance + tracker Complete#512
Merged
Conversation
|
Overall Assessment Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Path to Approval
|
0032b8d to
2fde00f
Compare
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
… Eq.2 equicorrelated; tracker -> Complete Reconciles diff_diff/power.py with the Bloom (1995) + Burlig, Preonas & Woerman (2020) source audits (paper reviews added in PR-A #506). Behavior change: the analytical panel-DiD variance was the Moulton (1+(T-1)rho)/T factor (wrong period-scaling, ~4x too small at rho=0/m=r=5, AND opposite rho-sign). Replaced with the within-unit equicorrelated special case of Burlig Eq. 2, sigma^2 (1/n_T+1/n_C)(1/m+1/r)(1-rho), so within-unit correlation now LOWERS the MDE. The MDE multiplier stays the normal-z Bloom multiplier (documented as a deliberate large-sample approximation to Burlig's t). - power.py: equicorrelated variance in _compute_variance + _compute_required_n; input validation for ALL designs (n_pre>=1, n_post>=1, rho in [-1/(T-1), 1)) enforced BEFORE the 2x2-vs-panel router, so invalid two-period shapes no longer fall through silently; the (1-rho) factor applies at T=2 too (Burlig footnote 11, the m=r=1 case), so rho is never silently ignored and rho=0 recovers Bloom's 2*sigma^2; docstrings rewritten; PR-A under-review notes removed. - REGISTRY ## PowerAnalysis equation block rewritten (z not t; unified equicorrelated SE with the 2x2 as the m=r=1 special case; cluster-m and inverted-R^2 terms removed; both reference surfaces; checklist ticked). - New tests/test_methodology_power.py (Bloom Table 1; 2x2 + panel closed forms; literal-equicorrelated Monte-Carlo; sample_size<->mde round-trip; input-guard + rho-at-T=2 + compute_* wrapper validation; base-R qnorm parity). - benchmarks/R/generate_power_golden.R + benchmarks/data/r_power_golden.json. - tests/test_power.py: inverted test_icc_effect + test_extreme_icc to Burlig's sign. - references.rst: + Frison & Pocock (1992), McKenzie (2012) lineage. - docs/tutorials/06_power_analysis.ipynb: corrected rho cells + summary. - METHODOLOGY_REVIEW.md row -> Complete; TODO row removed; CHANGELOG. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
2fde00f to
bb63f49
Compare
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
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
(1+(T−1)ρ)/Tdesign-effect factor — wrong two ways versus the source (period-scaling ~4× too small atρ=0, m=r=5, and the opposite ρ-sign) — with the within-unit equicorrelated special case of Burlig, Preonas & Woerman (2020) Eq. 2:Var(ATT) = σ²(1/n_T+1/n_C)(1/m+1/r)(1−ρ). Within-unit (serial) correlation now lowers the MDE (the DiD cancels the shared within-unit component). The 2×2 path is them=r=1case (footnote 11), so(1−ρ)applies there too;ρ=0recovers Bloom's2σ². The MDE multiplier stays the normal-zBloom multiplier (documented deviation from Burlig'st).n_pre≥1,n_post≥1,ρ∈[−1/(T−1),1),σ≥0(finite), positive group counts,treat_frac∈(0,1)— each raisesValueError(previously invalid two-period shapes / out-of-rangeρfell through silently).## PowerAnalysisequation block + both reference surfaces + checklist rewritten;references.rstadds McKenzie (2012) + Frison & Pocock (1992) as the equicorrelated lineage; tutorial06_power_analysis.ipynbcorrected;METHODOLOGY_REVIEW.mdrow → Complete + queue pruned;TODO.mdrow removed;CHANGELOG.md. PR-A under-review Notes removed across REGISTRY /power.py/references.rst.Methodology references (required if estimator / math changes)
PowerAnalysis(analytical MDE / power / sample-size;compute_*wrappers)docs/methodology/papers/bloom-1995-review.md,burlig-preonas-woerman-2020-review.md.t— labelled**Deviation from R:**in REGISTRY (parity reference is normal-based, notpwr.t.test). (2) Only the equicorrelated special case of Burlig Eq.2 is implemented (singleρ); the fully general serial-correlation-robust form (independent ψ^B/ψ^A/ψ^X) is not, and is documented as such.Validation
tests/test_methodology_power.py(Bloom Table 1 multipliers; 2×2 + panel closed forms; literal-equicorrelated Monte-Carlo validation of the panel variance;sample_size↔mderound-trip; input-guard +ρ-at-T=2+compute_*wrapper validation; base-Rqnormparity).tests/test_power.py: invertedtest_icc_effect+test_extreme_iccto Burlig's sign. R parity infra: NEWbenchmarks/R/generate_power_golden.R+benchmarks/data/r_power_golden.json(9 fixtures incl. a 2×2ρ>0fixture).docs/tutorials/06_power_analysis.ipynbcorrected (ρcells + summary), nbmake-verified;pytest tests/test_methodology_power.py tests/test_power.py= 227 passed locally (41 methodology + 186 unit).Security / privacy
🤖 Generated with Claude Code