test(estimation): use an over-dispersed fixture for the NB fits - #67
Merged
Merged
Conversation
arena-ai-coding-agent
Bot
requested a review
from hyperpolymath
as a code owner
September 25, 2026 22:19
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
hyperpolymath
approved these changes
Sep 25, 2026
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.
Why
After #66, the fits run. Run 36194648664 shows the remaining 19 failures and 6 errors. They all come from one fixture in
test/unit/test_estimation.jl: two of its three features fail insideMASS::glm.nb(n_tested = 1,n_failed = 2, statuspartial).The fixture is under-dispersed: its variance is below its mean in every group block (taxon 1, group A: mean 10.2, variance 3.1; taxon 2, group B: mean 30.3, variance 1.5). Under a negative binomial model, variance = μ + μ²/θ ≥ μ, so the maximum-likelihood θ for this data is infinite. A direct likelihood fit of the old table gives θ = 2e8 to 2e17 for every taxon under both offsets.
theta.mlthen stops at its iteration limit, and the estimator marks the fitfailed. That is the right behaviour, and this PR does not change it.What
counts_effectis replaced by a table with the same written-in group means (10→40, 30→30, 50→5). Each block has a variance near μ + μ²/6, all counts are ≥ 1 (so RLE is defined), and the numbers are deterministic literals.CHANGELOG.mdentry.Evidence (outside R: there is no R/Julia in the authoring sandbox)
Two independent NB2 maximum-likelihood fits (a direct scipy likelihood and statsmodels
NegativeBinomial) agree to 4 decimals, converge, and raise no warnings. The table uses the two offsets the tests use:Every assertion in the testsets holds against these numbers:
estimate ≈ log 4 ± 0.5,log2FC ≈ 2 ± 0.8,|flat| < 0.6,down < 0,p(up) < 0.01. The parity withglm.nbitself is what this PR's CI run checks.