Expand description
Probability distributions — the canonical, full-precision pdf / cdf / quantile
for the whole engine, built on the shared special functions (special).
This is what makes p-values and confidence intervals honest: hypothesis
tests (super::hypothesis) get their tail probabilities from a real
Student-t / χ² / F CDF here, not a |t| > 1.96 ⇒ p = 0.05 placeholder, and
domain libraries reuse normal instead of copying a local normal_cdf.
Submodules (one distribution each, PROJECT RULE §11): special (erf / incomplete
gamma & beta), normal, students_t, chi_squared, fisher_f.
Everything here is scalar f64 special-function evaluation — pointwise, not
GPU-amenable (CLAUDE.md §13: the CPU path is the right one; the data-aggregate
kernels that feed these, e.g. mean/variance, are the Reduction-class work that
routes through ComputePolicy).
Modules§
- chi_
squared - χ² (chi-squared) distribution — pdf / cdf / quantile + upper-tail p-value, used
by the goodness-of-fit and independence tests. CDF is exact via the regularized
lower incomplete gamma
P(k/2, x/2)(super::special::gammp). - fisher_
f - Fisher–Snedecor F-distribution — pdf / cdf / quantile + upper-tail p-value, used
by ANOVA and variance-ratio tests. CDF is exact via the regularized incomplete
beta
I_x(d₁/2, d₂/2)withx = d₁f/(d₁f + d₂). - multivariate_
normal - Multivariate normal distribution (PRML ch 2.3) — log-density, sampling, and MLE
for a
p-dimensional Gaussian. The covariance inverse / log-determinant and the sampling transform reuselinear_algebra::cholesky(no new solver). This is the foundation of the Bayesian spine (Bayesian linear regression, Gaussian processes, mixture/EM with full covariance). - normal
- Normal (Gaussian) distribution — pdf / cdf / quantile, the canonical engine-wide
implementation. The CDF is
½·erfc(−z/√2)over the sharedsuper::special::erfc(full precision), and the quantile is Acklam’s rational inverse refined by one Halley step (≈ machine precision). Domain libraries (financial_modeling’s Black–Scholes, etc.) should call these instead of re-deriving a localnormal_cdf. - special
- Special functions underpinning the probability distributions — the canonical, full-double-precision implementations the whole engine shares.
- students_
t - Student’s t-distribution — pdf / cdf / quantile + the two-sided p-value the
t-tests use. The CDF is exact via the regularized incomplete beta
(
super::special::betai); the quantile inverts it numerically.
Functions§
- beta_
pdf - Basic Beta PDF (alpha, beta >0) on (0,1).
- binomial_
cdf - Binomial CDF via direct sum (small n only; for large use normal approx in caller).
- binomial_
pmf - Binomial PMF: P(K = k | n, p).
- empirical_
cdf - Empirical CDF from sorted samples (for caller-sorted data).
- exponential_
cdf - Exponential CDF.
- exponential_
pdf - Exponential PDF (rate > 0).
- gamma_
pdf - Gamma PDF (shape k>0, scale theta>0).
- laplace_
cdf - Laplace CDF.
- laplace_
pdf - Laplace (double exponential) PDF.
- lognormal_
cdf - Lognormal CDF via normal cdf of ln(x).
- lognormal_
pdf - Lognormal PDF (mu, sigma>0).
- poisson_
cdf - Poisson CDF.
- poisson_
pmf - Poisson PMF.
- uniform_
cdf - Uniform CDF.
- uniform_
pdf - Uniform PDF on [a, b].
- weibull_
pdf - Weibull PDF (shape k>0, scale lambda>0).