Skip to main content

Module dist

Module dist 

Source
Expand description

Distribution functions for the rank tests: chi-square survival and the law of a weighted sum of independent χ²₁ variables (the null of the Baram–Porat / Robin–Smith statistics), by Imhof’s (1961) exact inversion or Satterthwaite’s two-moment approximation.

Dependency-free: log-gamma by Lanczos, regularized incomplete gamma by series/continued fraction (Numerical Recipes conventions), Imhof by composite Simpson with an oscillation-aware step.

Functions§

chi2_sf
Chi-square survival function P(χ²_df > q) (df may be non-integer).
df_tau_c_critical
Critical value q(α) with P(τ_c < q) = α for the Dickey–Fuller t-statistic with constant (asymptotic null).
gamma_q
Regularized upper incomplete gamma Q(a, x) = Γ(a, x)/Γ(a).
imhof_sf
Imhof’s (1961) exact inversion for P(Σ λ_i χ²₁ > q) (central case): P = 1/2 + (1/π) ∫₀^∞ sin θ(u) / (u ρ(u)) du with θ(u) = ½ Σ atan(λ_i u) − ½ q u, ρ(u) = Π (1 + λ_i² u²)^{1/4}.
kpss_critical
Critical value q(α) with P(KPSS > q) = α for the level-stationarity KPSS statistic (asymptotic null).
ln_gamma
Natural log of the gamma function (Lanczos, g = 7, ~15 digits).
satterthwaite_sf
Satterthwaite two-moment approximation to P(Σ λ_i χ²₁ > q): match mean and variance with g · χ²_ν, g = Σλ²/Σλ, ν = (Σλ)²/Σλ².