Repository navigation
feat: joint margins via tuple keys in GLM.margins(at=) - #312
Merged
Merged
Conversation
Tuple keys set several variables together, one row per cell; None enumerates fitted levels. variables= with at= gives effects at each cell instead of being ignored. Results gain an at field; return shapes unchanged.
at holds every set value, one column per variable, single-variable margins included; contrast holds categorical effect labels. A single result and a stacked list share the same columns.
Merged
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.
at={("a", "b"): [("a1", "b1"), ...]}gives joint predictive margins, one row per cell;Nonemeans every fitted level (full grid for a tuple key).variables=withat=gives marginal effects at each cell; it was silently ignored.GLMMarginsList(still alist): printing shows every table,to_polars()stacks them.GLMMargins.valuesis split intoat(one column per set variable, single-variable margins included) andcontrast(categorical effect labels). Thevaluecolumn into_polars()becomes the variable's name, orcontrast..valuesraises a guiding error. A single result and a stacked list share the same columns.Validated against R survey 4.5 + marginaleffects 0.32.0 (
avg_predictions,avg_comparisons,avg_slopes), including a domain fit: estimates to 1e-6, SEs to 1e-5.