Continuous distribution · also called noncentral χ²
Noncentral chi-squared distribution
The sum of squared independent normals with variance 1 whose means are not all zero: . Only the total matters. It is what a chi-squared test statistic follows when the null hypothesis is false, so it gives the power of the test, and it describes the energy of a signal received in Gaussian noise. With it is the ordinary chi-squared.
Noncentral chi-squared probability calculator
P(X ≤ 6.1) = 0.502135
At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends.
CDF
mean 7 · variance 22 · sd 4.69
Formulas
| Parameters |
|
|---|---|
| Support | |
| CDF | |
| Mean | |
| Variance | |
| MGF |
is the modified Bessel function of the first kind and the regularized lower incomplete gamma function. The CDF says the noncentral chi-squared is a Poisson() mixture of central chi-squareds with degrees of freedom. Some books (and older software) define the noncentrality as or ; SciPy's nc and NumPy's nonc are as here.
Worked example
A chi-squared test with 3 degrees of freedom rejects at the 5% level when the statistic exceeds 7.815. If the truth is an alternative with noncentrality , what is the test's power?
Under the alternative the statistic is noncentral chi-squared with , , so the power is . A shift of this size is caught only about a third of the time; a larger sample raises and the power with it. answer checked by code
How it relates to others
- Special case→ Chi-squared: Noncentral chi-squared() is Chi-squared(). checked by code
- Transformation← Normal: If are independent standard normals, is Noncentral chi-squared(). checked by code
All the relationships, as a diagram →
In Python
from scipy import stats
import numpy as np
X = stats.ncx2(df=3, nc=4)
X.pdf(5) # f(5) = 0.09698
X.cdf(5) # P(X ≤ 5) = 0.3993
X.mean(), X.var() # 7, 22
X.ppf(0.95) # 95th percentile
X.rvs(size=10, random_state=0)
rng = np.random.default_rng(0)
rng.noncentral_chisquare(df=3, nonc=4, size=10)Choosing between this and its neighbours? Which distribution for measurements and errors?