Repository navigation
fix: return excess kurtosis in stats/base/dists/kumaraswamy/kurtosis - #16186
Open
0PrashantYadav0 wants to merge 1 commit into
Open
0PrashantYadav0 wants to merge 1 commit into
0PrashantYadav0 wants to merge 1 commit into
Conversation
The implementation computed the kurtosis `μ₄/σ⁴` but never subtracted 3, so every value was off by exactly 3 from the documented excess kurtosis. This commit subtracts 3 in both the JavaScript and C implementations, fixes the README equation, updates the documented examples (including those for `kumaraswamy/ctor`), and replaces the placeholder tests with Julia fixtures. Closes: stdlib-js#15461
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
2 tasks done
This branch has not been deployed
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.
Resolves #15461.
Description
This pull request:
stats/base/dists/kumaraswamy/kurtosisto return the excess kurtosis by subtracting 3 in both the JavaScript and C implementations. Previously, the package returnedμ₄/σ⁴, so every value was too high by exactly 3 (e.g.,kurtosis( 1.0, 1.0 )returned1.8instead of-1.2for the standard uniform distribution).- 3and had an unbalanced closing parenthesis. The equation SVG will be regenerated by themarkdown_equationsworkflow.repl.txt, TypeScript declarations, JSDoc, C source) to the corrected values.kurtosisexamples instats/base/dists/kumaraswamy/ctor, whose.kurtosisgetter delegates to this package.TODO: Add fixturesplaceholder tests intest.jsandtest.native.jswith Julia fixtures generated byDistributions.jl, following the same pattern askumaraswamy/mean,variance, andstdev.Related Issues
This pull request has the following related issues:
Questions
The fixture tolerance is
1043762ULPs, which is the maximum observed difference against Distributions.jl. The worst case isb ≈ 1.5e-4, where both implementations suffer cancellation in the central moment computation. The median difference is ~260 ULPs. Happy to restrict the fixture domain instead if reviewers prefer a tighter tolerance.Other
Verification:
kumaraswamy/kurtosis( 3.0, 1.0 )andkumaraswamy/kurtosis( 1.0, 3.0 )both return~0.0952, matchingbeta/kurtosis.Distributions.jl'skurtosis(::Kumaraswamy)also subtracts 3.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was prepared with the help of Claude Code. I reviewed the changes and verified the results against Distributions.jl and the Beta distribution identities.
@stdlib-js/reviewers