Commit cafd26f
fix(ipw): preserve treatment design_info instead of overwriting with covariates (#842)
Fixes #835.
`InversePropensityWeighting._build_design_matrices` assigned
`self._t_design_info` twice in a row — first to the treatment matrix's
`design_info`, then immediately overwriting it with the covariate
matrix's `design_info`. The attribute name suggests treatment metadata
but only the covariate side was being kept.
Store the covariate side under `self._x_design_info` to match the
existing convention used in `instrumental_variable.py`,
`interrupted_time_series.py`, `regression_discontinuity.py`, and
`prepostnegd.py`. The treatment design now lives under
`self._t_design_info` as the name implies.
Adds a `TestDesignInfoAttributes` regression suite that asserts the
two attributes are distinct and hold the correct sides of the
formula. The class would have failed on master because
`_t_design_info` would have held the covariate columns and
`_x_design_info` would not have existed at all.
Assisted-by: Claude Code
Co-authored-by: Benjamin T. Vincent <inferencelab@gmail.com>1 parent 293c8ca commit cafd26f
2 files changed
Lines changed: 22 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
| 109 | + | |
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
0 commit comments