Skip to content

BUG: Preserve Series prediction index with extra parameters - #10590

Merged
bashtage merged 1 commit into
statsmodels:mainfrom
AryanRG:fix-predict-series-extra-parameters
Oct 26, 2026
Merged

bashtage merged 1 commit into
statsmodels:mainfrom
AryanRG:fix-predict-series-extra-parameters

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Predicting from a pandas Series can fail or return the wrong index when a model has one predictor and extra fitted parameters, such as Negative Binomial dispersion or ordered-model thresholds.

This checks the number of predictor columns instead of the total parameter count. It also preserves formula predictions after remove_data() or saving without the original data.

Regression tests, the base/formula suites and related prediction checks pass, along with Ruff. The full repository suite and Sphinx build were not run.

  • tests added / passed.
  • code/documentation is well formatted.
  • properly formatted commit message. See
    NumPy's guide.

AI Disclosure

Contributions must comply with the statsmodels AI Policy.

Tick exactly one of the following. If AI tools were used, replace the <...>
placeholders in the second option with the tool name(s) and how the tool's output was
used.

  • No AI tools were used to develop this pull request.
  • AI tools were used.
    Tool(s): Codex.
    Used for: implementation, regression tests, independent review and the description.
    • I have personally read, understood, and can explain every line of this diff, and
      have verified the statistical/numerical correctness of the change.

@bashtage
bashtage merged commit f754194 into statsmodels:main Oct 26, 2026
11 of 12 checks passed
bashtage added a commit that referenced this pull request Oct 26, 2026
Add MNLogit, which has two sets of parameters and a DataFrame result, to the
tests of predict with a Series, and a test that a Series is still one
observation when the model has two exog columns. Say what the tests of the
formula models after remove_data protect. Add the :pr: role and the other
affected models to the release note.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
bashtage added a commit that referenced this pull request Oct 26, 2026
TST: Follow up on #10590, test MNLogit and the one-row case of predict
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