Skip to content

Allow arm-specific numerator/denominator weight models#57

Merged
remlapmot merged 4 commits into
mainfrom
devel-2026-07-03
Jul 4, 2026
Merged

Allow arm-specific numerator/denominator weight models#57
remlapmot merged 4 commits into
mainfrom
devel-2026-07-03

Conversation

@remlapmot

Copy link
Copy Markdown
Contributor

Same addition as to SEQTaRget.

Also explicitly setting an argument for a forthcoming Polars change in default behaviour.

remlapmot and others added 4 commits July 3, 2026 13:50
SEQopts numerator/denominator now accept either a single formula (shared across treatment arms, unchanged) or a list with one formula per treatment_level, fitting a separate weight model with its own covariates in each arm. Supported for post-expansion weights only (weight_preexpansion=False), mirroring SEQTaRget commit 761d0d6.

_fit_numerator/_fit_denominator select each arm's formula inside the per-level loop; _col_string gathers referenced columns across list elements; _param_checker validates the list (weighted non-ITT, post-expansion, no None entries, length equal to treatment_level) and makes the identical-formula warning list-aware. The prediction path is unchanged because it uses the fitted per-level models directly. Adds tests/test_armspecific_weights.py.
Polars 2.0 flips the explode() empty_as_null default from True to False, which would silently turn exploded empty lists from null rows into dropped rows.
@remlapmot remlapmot requested a review from ryan-odea July 3, 2026 13:10

@ryan-odea ryan-odea left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@remlapmot remlapmot merged commit 284bb66 into main Jul 4, 2026
5 checks passed
@remlapmot remlapmot deleted the devel-2026-07-03 branch July 4, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants