Add survey design support to EfficientDiD covariates (DR) path#264
Add survey design support to EfficientDiD covariates (DR) path#264
Conversation
|
Overall Assessment Highest unmitigated severity is P1. The newly enabled EfficientDiD Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Path to Approval
|
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Static review only: I could not execute the added tests in this environment because Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Path to Approval
|
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Static review only: I did not execute the tests in this environment because the local Python environment is missing Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Path to Approval
|
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment ✅ Looks good Static review only: Executive Summary
Methodology Previously raised methodology blockers look fixed in the changed code: the estimator now guards the zero-weight never-treated control case before nuisance estimation in efficient_did.py:L609, and replicate-weight aggregation SEs no longer fall back to the wrong survey-variance helper in efficient_did.py:L1279 and efficient_did.py:L1395.
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Thread survey weights through all five nuisance estimation steps of the doubly-robust covariates path: WLS outcome regression, weighted sieve normal equations for propensity ratios/inverse propensities, survey-weighted Nadaraya-Watson kernel for conditional Omega*(X), and survey-weighted ATT averaging. Remove the NotImplementedError guard that blocked covariates + survey_design combinations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ator, zero-weight guard
- Make _compute_wif_contribution() survey-aware: use w_i * 1{G_i=g} - pg_k
formula when unit_weights present, matching staggered_aggregation.py
- Use explicit sum(unit_level_weights) denominator in bootstrap perturbation
when survey design is active
- Guard zero-weight cohorts: skip in fit loop, early return in
compute_generated_outcomes_cov when pi_g <= 0
- Add regression tests: analytical SE differs from unweighted, bootstrap SE
in ballpark of analytical, zero-weight cohort handled gracefully
- Update tutorial notebook: remove stale note about covariates+survey
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…eight guards - Switch aggregated survey SEs from compute_survey_vcov() to compute_survey_if_variance() with score-level psi values, avoiding double-weighting of the survey-weighted WIF term - Bootstrap now perturbs survey-score object w_i*eif_i/sum(w) instead of raw eif_i/n, matching analytical variance convention - Filter zero-weight comparison groups from valid pairs before nuisance estimation; guard in estimate_inverse_propensity_sieve fallback - Fix zero-weight test to use actual 0.0 weights with pytest.warns Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t never-treated - Add uses_replicate_variance branching in _aggregate_overall() and _aggregate_event_study() to route replicate designs to compute_replicate_if_variance() instead of compute_survey_if_variance() - Change zero-weight never-treated guard from warning to ValueError for covariates path — DR nuisance estimation requires positive-weight controls - Add test_zero_weight_never_treated_raises for the new error path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Exercises the compute_replicate_if_variance dispatch in _aggregate_overall and _aggregate_event_study with covariates + replicate-weight survey design, guarding against future regressions to the wrong variance helper. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cc0e659 to
d45df25
Compare
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Static review only: the workspace Python environment is missing Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
Path to Approval
|
…onsistency - Remove `and use_covariates` condition from zero-weight never-treated guard so both DR and nocov survey paths fail fast with ValueError - Remove stale covariates+survey limitation entry from survey-roadmap.md deferred list (now resolved) - Add test_zero_weight_never_treated_nocov_raises for nocov path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
/ai-review |
|
🔁 AI review rerun (requested by @igerber) Head SHA: Overall Assessment Static review only: I could not execute tests in this workspace because Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Summary
NotImplementedErrorguard that blockedcovariates+survey_designcombinationsMethodology references (required if estimator / math changes)
Validation
tests/test_survey_phase3.py— newTestEfficientDiDCovSurveyclass (6 tests), replacedtest_covariates_survey_raiseswithtest_covariates_survey_workstest_efficient_did.py, 63/63test_survey_phase3.pySecurity / privacy
Generated with Claude Code