docs: fix example variables and intro domain in @stdlib/stats/base/dists/chisquare/{median,mean}#12301
Open
Planeshifter wants to merge 2 commits into
Open
Conversation
…chisquare/median` Replaced `var y` and `var k` with `var v` in the negative-input and NaN `@example` blocks so the package matches the convention used by all seven single-argument sibling distribution packages (`entropy`, `kurtosis`, `mean`, `mode`, `skewness`, `stdev`, `variance`), where `var v = <pkg>( ... );` appears uniformly across all four examples in both the README and the TypeScript declaration file (87.5% conformance). The package's own `lib/main.js` already uses `var v` throughout, so the divergence was confined to `README.md` and `docs/types/index.d.ts`.
…an` intro The intro section previously read "where \`k\` is the degrees of freedom"; updated to "where \`k >= 0\` is the degrees of freedom" to match the convention used by the three other `NonNegativeNumber`-domain siblings in this namespace (`mode`, `stdev`, `variance` — 3/4 = 75% conformance). The constraint matches the existing Notes statement "If provided \`k < 0\`, the function returns \`NaN\`" found later in the same file.
Member
Author
|
/stdlib merge |
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.
Description
This pull request corrects two documentation-consistency drift findings in
@stdlib/stats/base/dists/chisquare— variable-name inconsistencies inmedianexamples and a missingk >= 0domain qualifier in themeanintro — bringing both packages into line with the established sibling-package conventions in the same namespace. No public behavior, function signatures, or test expectations change.Namespace summary
cdf,ctor,entropy,kurtosis,logpdf,mean,median,mgf,mode,pdf,quantile,skewness,stdev,variance).package.jsonshape and contents,manifest.jsonshape, README headings and prose, test/benchmark/example file naming, public signatures, validation prologues, error-construction style, JSDoc shape and@examplevariable conventions, TypeScript declaration shape, REPL-help shape, runtime dependencies.package.jsonmetadata (versions, authors, license, engines, OS list, contributors, homepage); universal directory layout per package type; universal JSDoc presence (@param,@returns,@example);var v = <pkg>( ... );convention across single-argument example blocks (7/8 single-arg siblings);where \k >= 0` is the degrees of freedomintro phrasing within theNonNegativeNumber`-domain group (3/4 packages).binding.gyp,lib/native.js,src/,include/,manifest.json,test/test.native.js) splits 10/4 = 71%; factory-function presence (lib/factory.js,test/test.factory.js) splits along semantic lines (functions of an evaluation variable have a factory; pure summary statistics do not); validation predicates split along the genuine mathematical domain of each formula (NonNegativeNumbervsPositiveNumber); test-fixture language differs instdev(Python) versus the rest (Julia) but fixing it would require regenerating fixtures.Per outlier package
@stdlib/stats/base/dists/chisquare/medianFixes variable-name drift in
README.md(line 58) anddocs/types/index.d.ts(examples 3–4), where the negative-input result was assigned tokinstead ofv. All seven single-argument sibling packages in this namespace (entropy,kurtosis,mean,mode,skewness,stdev,variance) usevar vin the corresponding blocks, as does the package's ownlib/main.jsJSDoc. Brings conformance to 8/8.@stdlib/stats/base/dists/chisquare/meanCorrects the intro formula line from
where \k` is the degrees of freedomtowhere `k >= 0` is the degrees of freedom, aligning with the threeNonNegativeNumber-domain siblings (mode,stdev,variance) in this namespace and with the Notes block andlib/main.jsvalidation (k < 0returnsNaN`) already present in the same package. The omission of the non-negativity constraint from the intro was an internal consistency drift with no behavioral impact.Related Issues
None.
Questions
No.
Other
Validation
package.jsonkeys and contents,manifest.jsonkeys, README heading sequences, and test/benchmark/example file naming.lib/main.js,lib/index.js, andlib/factory.js(where present) and returned a strict JSON bundle covering public signature, validation prologue, error-construction style, JSDoc shape, TypeScript declaration shape, REPL shape, and runtime dependencies.confirmed-driftfor every item in this PR.stdev/test/fixtures/python/*versus the Julia fixtures used by every other package — fixing this would require regenerating fixture data and updating tests, which falls outside the routine's mechanical scope.entropyandkurtosispackage.jsondescriptionfields (Chi-squared distribution entropy./Chi-squared distribution kurtosis.) versus the broader-stdlib convention ofdifferential entropy/excess kurtosis— ecosystem-wide presence is 62.5% and 85.3% respectively, both below the 90% gate required to flag absence as drift.binding.gyp,lib/native.js,src/,include/,manifest.json,benchmark/c/,examples/c/) inctor,median,pdf,quantile— 71% sibling presence is below the 75% threshold, and adding native bindings would require actual C implementations rather than a mechanical patch. An open PR (feat: add C implementation forstats/base/dists/chisquare/pdf#11634) is separately adding the C implementation forpdf.lib/factory.js,test/test.factory.js— present only in packages that take an evaluation variable (cdf,logpdf,mgf,pdf,quantile), absent in pure summary statistics; this split is semantic, not drift.k < 0.0forNonNegativeNumber-domain packages;k <= 0.0forPositiveNumber-domain packages) — both forms are mathematically correct for the formulas in question.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code as part of a cross-package API drift detection routine: structural and semantic features were extracted from every member of the
stats/base/dists/chisquarenamespace, candidate drift items were identified by majority vote (≥75% threshold), and each surviving correction was independently confirmed by three validation agents (Opus semantic review, Opus cross-reference, Sonnet structural review) before being applied. The changes are pure documentation-consistency edits — no behavior, signatures, or tests change.Generated by Claude Code