Skip to content

v1.28.0

Choose a tag to compare

@github-actions github-actions released this 06 Jun 18:20
09d2c70

Added

  • BetaGeometric distribution: PMF f(k;α,β)=B(α+1,β+k−1)/B(α,β), support k∈{1,2,3,…}. Implements a closed-form O(1) CDF derived via a telescoping Beta-function identity (F(k)=1−B(α,β+k)/B(α,β)), replacing the previous PreComputed accumulation stub. Accessible as ran.dist.BetaGeometric(alpha, beta) (#703).
  • BetaNegativeBinomial distribution: PMF f(k;r,α,β)=Γ(r+k)/(Γ(k+1)Γ(r))·B(α+r,β+k)/B(α,β), support k∈{0,1,2,…}. Analytic CDF via forward recurrence, direct compound sampler (p~Beta(α,β), k|p~NegativeBinomial(r,p)). Accessible as ran.dist.BetaNegativeBinomial(r, alpha, beta) (#704).

Changed

  • fit() integer grid window for Chi2, Chi, InverseChi2, IrwinHall, UniformProduct, HeadsMinusTails, Soliton, Erlang, and F now adapts to the observed Fisher information at the seed via w = max(5, ⌈3/√I_obs⌉) instead of a fixed ±5 window. The window automatically widens for high-variance seeds (e.g., F(5, 300) from small samples) and narrows when the data strongly determines the integer parameter (#663).
  • Tightened distribution test tolerance to 1e-14 in test/dist.js and test/test-utils.js: refValTol now uses max(|expected|·1e-14, 1e-14) for normal-range values and a 1e-4 relative guard for sub-1e-14 reference values, the finite-difference pdf–cdf consistency check retains its own FD_FLOOR = 1e-9 floor, and reference values for Hoyt, Kolmogorov, NoncentralBeta, ConwayMaxwellPoisson, NegativeHypergeometric, and IrwinHall are updated from their pre-v1.27.0 external sources to the current double-precision computed values (#562).

Fixed

  • logGamma now returns exact IEEE 754 results for positive integer arguments z ≤ 171 via a 171-entry LOG_FACTORIAL table (each entry independently rounded from mpmath at 50 decimal places, ≤ 0.5 ULP), eliminating the Lanczos drift that previously accumulated to 2–6 ULP when logBeta/logBinomial combined three calls. Combined with improved CDF summation strategies for BetaBinomial and NegativeHypergeometric — using the forward sum directly when CDF(x) < 0.25 (avoiding catastrophic cancellation in 1 − bwd) and Math.min(1, max(fwd, 1 − bwd)) near the midpoint — this lifts BetaBinomial and NegativeHypergeometric pmf/cdf precision from ~1e-12 to the arithmetic floor of ~2e-14 (#684).
  • BetaBinomial._cdf and NegativeHypergeometric._cdf midpoint path now clamps the return value to Math.min(1, Math.max(fwd, 1 − bwd)), restoring the safety clamp inadvertently removed in #684. Without this, IEEE 754 rounding in logBeta/logBinomial terms can push accumulated probability sums marginally above 1, causing survival() to return negative values (#701).