Commit d7ddb19
Fix AI review: remove over-restrictive group-constant validation, vectorize IF expansion
- Remove _validate_group_constant_survey() call - the IF expansion
psi_i = U[g] * (w_i / W_g) handles observation-level variation in
weights, strata, and PSU within groups correctly
- Vectorize _survey_se_from_group_if using np.bincount + np.unique
(was Python loops over all observations)
- Replace test_rejects_varying_weights_within_group with two positive
tests: varying weights accepted, and varying weights change ATT
(time-varying noise to survive first-differencing)
- Remove unused survey_weight_type variable
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 531013e commit d7ddb19
2 files changed
Lines changed: 66 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
630 | 630 | | |
631 | 631 | | |
632 | 632 | | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
| 633 | + | |
637 | 634 | | |
638 | | - | |
| 635 | + | |
639 | 636 | | |
640 | 637 | | |
641 | 638 | | |
| |||
653 | 650 | | |
654 | 651 | | |
655 | 652 | | |
656 | | - | |
657 | | - | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
658 | 656 | | |
659 | 657 | | |
660 | 658 | | |
| |||
4593 | 4591 | | |
4594 | 4592 | | |
4595 | 4593 | | |
4596 | | - | |
4597 | 4594 | | |
4598 | | - | |
4599 | | - | |
4600 | | - | |
4601 | | - | |
| 4595 | + | |
| 4596 | + | |
| 4597 | + | |
| 4598 | + | |
| 4599 | + | |
4602 | 4600 | | |
4603 | | - | |
4604 | | - | |
4605 | | - | |
4606 | | - | |
4607 | | - | |
| 4601 | + | |
| 4602 | + | |
| 4603 | + | |
| 4604 | + | |
4608 | 4605 | | |
4609 | 4606 | | |
4610 | | - | |
4611 | | - | |
4612 | | - | |
4613 | | - | |
4614 | | - | |
4615 | | - | |
4616 | | - | |
| 4607 | + | |
| 4608 | + | |
4617 | 4609 | | |
4618 | 4610 | | |
4619 | 4611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
267 | | - | |
268 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
269 | 271 | | |
270 | | - | |
271 | | - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
272 | 277 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
282 | 319 | | |
283 | 320 | | |
284 | 321 | | |
| |||
0 commit comments