Commit 1249ded
imputation: suppress cluster_name/n_clusters under ANY survey design (incl. replicate)
The Results-metadata suppression gate previously fired only when
`resolved_survey.psu is not None`, which left replicate-weight survey
fits (psu=None by SurveyDesign mutual-exclusion rules) leaking
cluster_name="unit" and n_clusters=n_units onto Results. Summary then
printed "Number of clusters" plus the unit-cluster CR1 label, even
though the new public contract says both fields are None under survey
designs because replicate-variance ignores PSU/cluster entirely
(replicates encode the design implicitly via BRR / Fay / JK1 / JKn / SDR
reweighting).
Fix: gate on `resolved_survey is not None` so the suppression also
covers the replicate-weight branch. Regression test added:
`test_cluster_name_suppressed_under_replicate_survey` asserts both
fields are None and summary omits the Number-of-clusters line + the
CR1 label under a JK1 replicate design.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent b819aa8 commit 1249ded
2 files changed
Lines changed: 35 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
890 | | - | |
891 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
892 | 895 | | |
893 | 896 | | |
894 | 897 | | |
895 | 898 | | |
896 | 899 | | |
897 | 900 | | |
898 | | - | |
899 | | - | |
| 901 | + | |
900 | 902 | | |
901 | 903 | | |
902 | 904 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2831 | 2831 | | |
2832 | 2832 | | |
2833 | 2833 | | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
2834 | 2863 | | |
2835 | 2864 | | |
2836 | 2865 | | |
| |||
0 commit comments