Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: GLM models now save the names of input Pandas Series #9130

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmahlik
Copy link

@jmahlik jmahlik commented Jan 24, 2024

Offset, exposure, freq_weights and var_weights have the name of the series saved on the model object. They can be accessed via the class properties.

Closes #9100

Getting this as a starting point. This enables the feature for GLM's. Happy to make any recommended changes.

I didn't edit the release notes, wasn't sure if this would be worth mentioning. Kept the smaller notes in the commit message for now.

I opted for only doing one dimensional arrays in the helper because the caller would need to check the shape if it returned more than one name. Seems like a separate helper for multi dimensional might be needed unless there's a different way we were expecting to use it.

@josef-pkt
Copy link
Member

josef-pkt commented Apr 13, 2024

Thanks, looks good

However, we need a default name if offset or similar are used, i.e. name should be a string and not None.
The name attribute is None should be for the case when the corresponding variable, offset, ..., was not used.

one possibility
add a extra argument to the helper function with the default name, e.g. "offset" or "exposure".
That way the helper function would still be generic, and we don't need to fix up each returned None name.
something like:
def _as_array_with_name(obj, default_name="")

We want to be able to add a string to the summary table

Offset, exposure, freq_weights and var_weights have the name of the
series saved on the model object. They can be accessed via the class
properties.

Closes statsmodels#9100
@jmahlik
Copy link
Author

jmahlik commented Apr 16, 2024

The test failure appears unrelated.

FAILED statsmodels/tsa/statespace/tests/test_exact_diffuse_filtering.py::test_nondiagonal_obs_cov failing for an assert_allclose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save the offset name in GLM and results wrapper
2 participants