Repository navigation
Fix srdist by passing nranges=1 to Rmath.ptukey/qtukey - #211
Merged
Merged
Conversation
The inlining of the `RFunctions` macro in #188 dropped the special-case that appended a literal `1` for `:tukey`, so the `lower_tail`/`log_p` Bool flags shifted into the `nranges` positional slot and inverted CDF↔CCDF (e.g. `srdistcdf(2, 2, 0) == 1.0` instead of `0`). Restore the argument explicitly. The existing rmathcomp tests compared StatsFuns' buggy `srdistcdf` against an equally buggy direct `Rmath.ptukey(..., true, false)` call, so the regression went unnoticed; fix the test harness to inject `nranges=1` for tukey and add a strict boundary-behaviour testset covering `x = 0` and `x = Inf`.
devmotion
marked this pull request as ready for review
May 28, 2026 18:29
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #211 +/- ##
=======================================
Coverage 72.39% 72.39%
=======================================
Files 22 22
Lines 1007 1007
=======================================
Hits 729 729
Misses 278 278 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
andreasnoack
approved these changes
Jun 3, 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.
Summary
The inlining of the
RFunctionsmacro in #188 dropped the special-case thatappended a literal
1for:tukey, so thelower_tail/log_pBoolflagsshifted into the
nrangespositional slot ofRmath.ptukey/qtukey. As aresult,
srdistcdf↔srdistccdfare silently inverted onv2.0.0and theinverse CDF functions also return wrong values. For example:
Restore the missing
1argument explicitly in all 8Rmath.ptukey/qtukeycalls.
Why the existing tests didn't catch it
The
rmathcompharness compared StatsFuns' buggysrdistcdfagainst anequally buggy direct
Rmath.ptukey(..., true, false)call, so the testagreed with itself. Fix the harness to inject
nranges=1for tukey whenbuilding the Rmath-side lambdas, and add a strict-equality
@testset "srdist boundary behaviour"coveringx = 0andx = Infforall four cdf-like functions.
Test plan
Pkg.test()passes locally (full suite)srdist boundary behaviourtestset passes (8 strict==assertions)StudentizedRangeandTruncated{StudentizedRange}test failures on Update to StatsFuns@2 Distributions.jl#2062go away when this branch is dev'd in
🤖 Generated with Claude Code