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(α)withP(τ_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)) duwithθ(u) = ½ Σ atan(λ_i u) − ½ q u,ρ(u) = Π (1 + λ_i² u²)^{1/4}. - kpss_
critical - Critical value
q(α)withP(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 withg · χ²_ν,g = Σλ²/Σλ,ν = (Σλ)²/Σλ².