Repository navigation
MAINT: Follow up on #10521, #10522, #10529 and #10554 - #10555
Merged
Merged
Conversation
which is now case sensitive like in GLM.predict, a list exog is converted with array_like (it raised AttributeError) and a 1-d exog raises a ValueError. The predict docstrings say that only the fixed effects are used, so that mean is the mean given zero random effects, and which estimate fit_map and fit_vb provide. The tests cover fit_map and fit_vb, Binomial and Poisson, both values of which and all call forms of the deprecated linear argument. Follow up to statsmodelsgh-10554. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
With the DerSimonian-Laird tau2 truncated at zero (statsmodelsgh-10522), h2 = q / (k - 1) was still below 1 and i2 negative (-inf for q = 0) when q < k - 1. Floor them at 1 and 0 like metafor. combine_effects failed for plain lists although the docstring says array_like, so lists and tuples are converted. Use the axis keyword in sum for pandas input. The docstring documents the truncation of tau2 and the floors. Follow up to statsmodelsgh-10522, see statsmodelsgh-10520. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Reference values from metafor 5.2.1 rma(method='DL') for the data of statsmodelsgh-10520 and a heterogeneous k=6 data set, tests of the truncation for both DL methods and _fit_tau_mm with uniform weights, the q == k - 1 boundary, the h2 and i2 floors and list input. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The generic discrete ppf of SciPy can raise RuntimeError (skellam with large parameters), which worked before statsmodelsgh-10529. Fall back to a search using only the cdf. The bin edges were moved by a fixed 1e-8, which is lost for edges of about 1e9 and larger, so use np.nextafter. Validate nsupp, remove a dead cdf call and a commented line, and document the change of the support in gof_binning_discrete and gof_chisquare_discrete. Follow up to statsmodelsgh-10529, see statsmodelsgh-4359. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…rete Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ower The ftotal null variance used (1 + value * nobs_ratio)**2 where the score variance has (value + nobs_ratio)**2, so ftotal differed from score at dispersion 0 for nobs_ratio != 1 (0.7121 versus 0.7841 for rates 1.1 and 1, nobs_ratio 4, nobs1 400, and 0.7874 in an exact enumeration of the Poisson TOST). This is fixed in power_equivalence_neginb_2indep and power_negbin_ratio_2indep. power_equivalence_poisson_2indep and power_equivalence_neginb_2indep now require a positive finite nobs_ratio, which gave nan or a ZeroDivisionError. Add versionchanged notes. Follow up to statsmodelsgh-10521, see statsmodelsgh-10519. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Enumerate the counts of the Poisson TOST for nobs_ratio of 0.5, 2 and 4, parametrize the negbin to Poisson limit test over method_var, and test the validation of nobs_ratio. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The next release is 0.15.1. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This was referenced Oct 24, 2026
The Azure python_310 job failed test_combine_effects_dl_metafor[ex_het6-*] (the t quantile differs from R by 2e-9 relative) and test_gof_binning_discrete_large_mean_edges (the Poisson ppf of that SciPy is off by up to 7 for a mean of 1e9). Compare the t interval with rtol=1e-7, and take the edges from gof_binning_discrete itself, checked against the scan of the cdf with rtol=1e-7, so that the test of the exact edges does not depend on the accuracy of ppf. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…o wip-nits-merged-4 # Conflicts: # docs/source/release/version0.16.0.rst
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.
Follow up to the four PRs that were merged without changes after the review: #10521, #10522, #10529 and #10554. It addresses the points that were left open in the reviews. Each PR has its own commits (code, tests) and the release notes are the last commit. The tests of the touched files pass (2188 passed, 11 skipped, 1 xfailed) and
ruff checkis clean.#10554 (
BayesMixedGLM.predict,which)whichis case sensitive, as inGLM.predict.exograisedAttributeError; it is now converted witharray_like. A 1-dexograises aValueError."mean"is the mean given zero random effects and not the marginal mean, and thatfit_mapgives the posterior mode andfit_vbthe variational posterior mean.fit_mapandfit_vb, Binomial and Poisson, both values ofwhichand the call forms of the deprecatedlinearargument. The references are computed by hand fromfe_mean.#10522 (
combine_effects, DerSimonian-Lairdtau2)tau2truncated at zero,h2 = q / (k - 1)was still below 1 andi2negative (-infforq = 0) whenq < k - 1. They are floored at 1 and 0, which is whatmetafor::rmareports. The data of BUG: combine_effects DerSimonian-Laird tau2 not truncated at zero #10520 gavei2 = -211.6andh2 = 0.0047.array_like, but a list raised).sum(0)issum(axis=0)for pandas input.metafor5.2.1rma(yi, vi, method="DL")for the data of BUG: combine_effects DerSimonian-Laird tau2 not truncated at zero #10520 and a heterogeneous data set with 6 studies are inresults_meta.pywith the R calls. New tests: both DL methods,_fit_tau_mmwith uniform weights, the boundaryq == k - 1, the floors.#10529 (
gof_binning_discrete)ppfof SciPy can raiseRuntimeError(skellamwith large parameters, 131 of 420 random parameter sets); this worked before BUG: remove fixed bounds from discrete GOF binning #10529. The function now falls back to a search that only uses thecdf.1e-8, which is lost for edges of about1e9and larger (Poisson with mean1e9). They usenp.nextafter.nsuppis validated (it must be at least 1), a deadcdfcall and a commented line are removed, and the docstrings of both functions document that the support comes fromdistfn.support, the small expected count of the tail bin and the dropped observations outside the support. The test comment says that the check is an internal equivalence with the old rule.#10521 (
power_equivalence_*fornobs_ratio != 1)ftotalnull variance used(1 + value * nobs_ratio)**2where the score variance has(value + nobs_ratio)**2. Withdispersion=0the two must agree: for rates 1.1 and 1,nobs_ratio=4andnobs1=400the powers were 0.7121 (ftotal) and 0.7841 (score), and an exact enumeration of the Poisson TOST gives 0.7874. The fix is inpower_equivalence_neginb_2indepandpower_negbin_ratio_2indep(one line in theftotalbranch). Results fornobs_ratio=1are unchanged.nobs_ratiois validated in both equivalence functions (positive and finite, scalar orarray_like, as before);0and-1gavenanor aZeroDivisionError.nobs_ratioin 0.5, 2 and 4, the negbin to Poisson limit test is parametrized overmethod_var, and the comments cite BUG: power_equivalence_poisson_2indep and power_equivalence_neginb_2indep wrong for nobs_ratio != 1 #10519.Not changed
gof_chisquare_discretestill uses 20 bins; BUG/ENH: hard coded settings in stats.gof.gof_chisquare_discrete #4359 also asks for options.ppfcall forzipf(1.2)can use a lot of time and memory ingof_binning_discrete; the cdf search takes about 2 s for the same quantile, but switching the normal path is a design decision.combine_effectswith a single study still givesnanforh2,i2andtau2; themax(0, .)in_fit_tau_iter_mmstays because it also handles that case.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 Sonnet 5.5).
Used for: reviewing the four merged PRs, drafting the code, docstring and release note changes, writing the tests, and checking values against R.
I have personally read, understood, and can explain every line of this diff, and
have verified the statistical/numerical correctness of the change.
🤖 Generated with Claude Code