Add survey data support for SyntheticDiD and TROP (Phase 5)#236
Merged
Add survey data support for SyntheticDiD and TROP (Phase 5)#236
Conversation
pweight-only survey integration for the last two estimators without survey support. SDID: both-sides weighted (WLS interpretation) with treated means survey-weighted and omega composed with control survey weights post-optimization. TROP: survey weights in ATT aggregation only. Rust backend updated for both bootstrap functions. Includes 26 new tests, REGISTRY.md methodology notes, and roadmap updates. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Return composed ω_eff (not raw ω) in SyntheticDiDResults.unit_weights so returned weights match the estimator actually used under survey - Add NaN finite guard in TROP local _fit_with_fixed_lambda() and Rust bootstrap to skip non-finite treated outcomes (match main fit contract) - Add finite guard on bootstrap ATT accumulator - Add regression tests for effective weight semantics and NaN bootstrap Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
P3 fixes: - Align to_dict() survey schema: add sum_weights, n_strata, n_psu, df_survey unconditionally (match DiDResults pattern) - Extract shared _resolve_pweight_only() and _extract_unit_survey_weights() helpers in survey.py; refactor SDID, TROP, trop_global, trop_local to use them (reduce duplication) P2 tests: - Add pinned numerical test for SDID weighted ATT on tiny panel - Add pinned test for TROP weighted ATT directional check - Add schema alignment test for to_dict() survey fields Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Overall Assessment ✅ Looks good Executive Summary
Methodology
Code Quality
Performance
Maintainability
Tech Debt
Security
Documentation/Tests
|
Addresses CI review P3: the global method's survey weight path (separate from local) was only smoke-tested. This test verifies non-uniform survey weights actually change the ATT for method="global". Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
Author
|
/ai-review |
|
🔁 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
_resolve_pweight_only,_extract_unit_survey_weights) to reduce duplicationto_dict()survey metadata schema across all result classes_fit_with_fixed_lambda()and Rust bootstrapMethodology references (required if estimator / math changes)
Validation
tests/test_survey_phase5.py(32 new tests),tests/test_trop.py(1 fix for tracking_fit wrapper)Security / privacy
🤖 Generated with Claude Code