- Update obioptions.Version from "Release 4.4.29" to "/v/ Release v5" - Update version.txt from 4.29 → .30 (automated by Makefile)
1.6 KiB
Statistical Functions in obistats Package
This Go package provides high-precision statistical functions for probability distributions, particularly the regularized incomplete beta function, used in hypothesis testing and confidence interval calculations.
Core Functions
-
mathBeta(a, b)
Computes the complete beta functionB(a,b) = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}using logarithms of the gamma function (math.Lgamma) for numerical stability. -
lgamma(x)
Wrapper aroundmath.Lgamma, returning the natural logarithm of the absolute value of the gamma function. -
mathBetaInc(x, a, b)
Computes the regularized incomplete beta functionI_x(a,b). This is essential for computing cumulative distribution functions (CDFs) of the beta, F-, and t-distributions.- Uses continued fraction evaluation (via
betacf) for accuracy. - Applies symmetry transformation (
x \to 1-x) when beneficial (per Numerical Recipes). - Returns
NaNfor invalid inputs (x < 0 || x > 1).
- Uses continued fraction evaluation (via
-
betacf(x, a, b)
Implements the continued fraction expansion ofI_x(a,b).- Iteratively evaluates recurrence relations for even/odd terms.
- Uses
epsilon = 3e-14andmaxIterations = 200for convergence. - Handles near-zero denominators via
raiseZero.
Use Cases
- Statistical hypothesis testing (e.g., Fisher’s exact test).
- Beta, binomial proportion confidence intervals.
- F-test and Student's t-distribution CDF computations.
Implementation Notes
Based on Numerical Recipes in C, §6.4, with robustness enhancements for floating-point edge cases.