Repository navigation
BUG: Drop missing values in all ProcessMLE arrays - #11255
Open
JakkulaVeerababu wants to merge 2 commits into
Open
JakkulaVeerababu wants to merge 2 commits into
JakkulaVeerababu wants to merge 2 commits into
Conversation
ProcessMLE failed whenever a value was missing, both in from_formula (which drops missing rows by default) and with missing="drop". The base class treats 2-d extra arrays as square and drops their columns too, __init__ checked and grouped the arguments before the rows were dropped, and the scale, smoothness and noise formulas each dropped their own rows. ProcessMLE now finds the rows with a missing value in endog, exog, exog_scale, exog_smooth, exog_noise, time or groups, and drops them from all of them. from_formula keeps the rows that the extra formulas drop as NaN, so that they are dropped together with the mean formula's rows. An invalid missing value still raises a ValueError, and with missing="none" the arrays are passed on unchanged. Closes statsmodels#11231 AI disclosure: written with Claude Code (Claude Opus 5.5), reviewed and tested by me.
AI disclosure: written with Claude Code (Claude Opus 5.5), reviewed by me.
JakkulaVeerababu
force-pushed
the
fix-processmle-missing
branch
from
November 29, 2026 00:39
cb31a55 to
4ada197
Compare
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.
NumPy's guide.
ProcessMLEnow drops the rows with a missing value fromendog,exog,exog_scale,exog_smooth,exog_noise,timeandgroupstogether, infrom_formulaand withmissing="drop". All five paths in the issue's table now work.ProcessMLE.__init__drops the rows itself and passesmissing="none"to the base class.ModelData.handle_missingassumes 2-D extra arrays are square, so it cannot reduceexog_scalewith more than one column.missing="raise"raisesMissingDataError.missing="none"is unchanged, and an invalidmissingvalue still raises aValueError, as in the base class._check_argsand the group index now use the attributes after the rows are dropped.from_formulaevaluates the scale, smoothness and noise formulas with the same missing-value action as the mean formula. Rows those formulas drop are put back as NaN, so every array loses the same rows.Tests: each path is compared with a model built from data with those rows dropped first. The arrays, groups and log-likelihood match. Both formula engines give the same result. For the arrays, a missing value is tested in each of the seven arguments, with NumPy and with pandas inputs.
test_processreg.pypasses (57 tests), and so doregression/tests,formula/testsandbase/tests/test_data.py(2539 passed). 37 of the 40 new tests fail onmain; the other 3 check thatendogandexogof different lengths are still reported by the base class.ruff checkpasses.The branch is rebased on
mainafter #11230. The release-note fragment is in the second commit.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.
Tool(s):
Claude Code (Claude Opus 5.5).Used for:
drafting the implementation, writing the tests and debugging.I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.