Skip to main content

Module distributions

Module distributions 

Source
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) with x = 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 reuse linear_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 shared super::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 local normal_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).