1. Home
  2. Explore
  3. Mathematics
  4. Chi-Squared Distribution

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Chi-Squared Distribution

📚 Study Notes: Advanced Hypothesis Testing and Key Distributions

Chi-Squared Distribution

The chi-squared distribution arises when summing the squares of independent standard Gaussian random variables. It is fundamental to understanding sample variance and many test statistics.

Definition and Properties

  • If Z1,Z2,…,ZnZ_1, Z_2, \dots, Z_nZ1​,Z2​,…,Zn​ are independent N(0,1)N(0,1)N(0,1) random variables, then ∑i=1nZi2\sum_{i=1}^n Z_i^2∑i=1n​Zi2​ follows a chi-squared distribution with nnn degrees of freedom, denoted χn2\chi^2_nχn2​.

  • The sample variance Sn2=1n∑i=1n(Xi−Xˉ)2S_n^2 = \frac{1}{n}\sum_{i=1}^n (X_i - \bar{X})^2Sn2​=n1​∑i=1n​(Xi​−Xˉ)2 from a Gaussian sample is related to a chi-squared distribution: nSn2σ2∼χn−12\frac{n S_n^2}{\sigma^2} \sim \chi^2_{n-1}σ2nSn2​​∼χn−12​ (the n−1n-1n−1 degrees of freedom arise from estimating the mean).

Key takeaway: The parameter “degrees of freedom” equals the number of independent squared standard normals summed. For sample variance, one degree is lost because the sample mean is estimated.

Probability Density Function

The chi-squared PDF has an explicit form that changes with degrees of freedom:

  • With 1 degree of freedom, it is the distribution of the square of a single standard Gaussian — highly skewed.

  • As degrees of freedom increase (2, 3, 4 … 10), the distribution becomes flatter and shifts to the right — the expected value equals nnn, so the mass moves toward infinity as nnn grows.

  • Unlike the Gaussian, there is no “standard” chi-squared distribution that can be obtained by simple scaling. Different degrees of freedom require separate quantile tables.

Why It Matters

  • The chi-squared distribution appears in Wald tests and likelihood ratio tests as the asymptotic distribution of test statistics.

  • Because it depends on the number of degrees of freedom, tables at the back of books list quantiles for many nnn values — one row per sample size.


Student t-Distribution

The t-distribution (also called Student’s t) is used when the population variance is unknown and must be estimated from the data. It was developed by William Sealy Gosset (publishing under the pseudonym “Student”) in 1908 while working at the Guinness Brewery.

Definition

Let Z∼N(0,1)Z \sim N(0,1)Z∼N(0,1) and V∼χd2V \sim \chi^2_dV∼χd2​ be independent. Then the random variable

T=ZV/dT = \frac{Z}{\sqrt{V/d}}T=V/d​Z​

follows a t-distribution with ddd degrees of freedom.

Connection to Sample Mean

When using the sample variance Sn2S_n^2Sn2​ instead of the true σ2\sigma^2σ2, the normalized sample mean follows a t-distribution under Gaussian assumptions:

  • For a sample X1,…,XnX_1,\dots,X_nX1​,…,Xn​ i.i.d. N(μ,σ2)N(\mu,\sigma^2)N(μ,σ2), the statistic

    Xˉn−μSn/n\frac{\bar{X}_n - \mu}{S_n/\sqrt{n}}Sn​/n​Xˉn​−μ​

Key insight: This allows us to perform tests and confidence intervals without knowing σ\sigmaσ — the t-distribution accounts for the extra uncertainty from estimating the variance.

Shape and Comparison to Normal

  • The t-distribution has heavier tails than the standard normal — there is more probability in the extremes because the denominator introduces additional variability.

  • As ddd increases, the t-distribution approaches the standard normal. For d≥50d \geq 50d≥50, the difference is negligible in practice.

  • For small ddd (e.g., d=5d=5d=5), the tails are noticeably thicker, leading to wider confidence intervals for the same level of confidence.

  • At d=1d=1d=1 (Cauchy distribution), the tails are extremely heavy — rarely used in practice.

Important: The t-distribution is exact only when the underlying data is Gaussian. For non-Gaussian data, the central limit theorem may justify using the normal approximation when the sample size is large (say, n>30n>30n>30), but for small samples the t-distribution should be used with caution.


Wald Test

The Wald test is a general method for testing hypotheses about parameters when the maximum likelihood estimator (MLE) is asymptotically normal.

Setup

  • We have an i.i.d. sample from a parametric model with ddd-dimensional parameter θ∈Θ⊆Rd\theta \in \Theta \subseteq \mathbb{R}^dθ∈Θ⊆Rd.

  • Null hypothesis: H0:θ=θ0H_0: \theta = \theta_0H0​:θ=θ0​ versus H1:θ≠θ0H_1: \theta \neq \theta_0H1​:θ=θ0​.

  • Under regularity conditions, the MLE θ^nMLE\hat{\theta}_n^{\text{MLE}}θ^nMLE​ satisfies

    n(θ^nMLE−θ0)→dN(0,I(θ0)−1)\sqrt{n}(\hat{\theta}_n^{\text{MLE}} - \theta_0) \xrightarrow{d} N(0, I(\theta_0)^{-1})n​(θ^nMLE​−θ0​)d​N(0,I(θ0​)−1)

Test Statistic

To obtain a pivotal quantity (distribution free of unknown parameters), we multiply by the square root of the Fisher information:

n I(θ0)1/2(θ^nMLE−θ0)→dN(0,Id)\sqrt{n} \, I(\theta_0)^{1/2} (\hat{\theta}_n^{\text{MLE}} - \theta_0) \xrightarrow{d} N(0, I_d)n​I(θ0​)1/2(θ^nMLE​−θ0​)d​N(0,Id​)

where IdI_dId​ is the ddd-dimensional identity matrix.

The Wald test statistic is the squared Euclidean norm of this vector:

Tn=n(θ^nMLE−θ0)⊤I(θ0)(θ^nMLE−θ0)T_n = n (\hat{\theta}_n^{\text{MLE}} - \theta_0)^\top I(\theta_0) (\hat{\theta}_n^{\text{MLE}} - \theta_0)Tn​=n(θ^nMLE​−θ0​)⊤I(θ0​)(θ^nMLE​−θ0​)
  • Under H0H_0H0​, Tn→dχd2T_n \xrightarrow{d} \chi^2_dTn​d​χd2​ (chi-squared with ddd degrees of freedom).

  • The test rejects H0H_0H0​ when Tn>qαT_n > q_\alphaTn​>qα​, where qαq_\alphaqα​ is the 1−α1-\alpha1−α quantile of χd2\chi^2_dχd2​.

Practical note: Often I(θ0)I(\theta_0)I(θ0​) is replaced by I(θ^nMLE)I(\hat{\theta}_n^{\text{MLE}})I(θ^nMLE​) (estimated information) — both are valid asymptotically, similar to using the estimated variance in a z-test.

Geometric Interpretation

The Fisher information matrix acts as a metric that reweights directions in parameter space. A large test statistic indicates that the MLE is far from θ0\theta_0θ0​ in this geometry — directions with low information (high variance) contribute less to the distance.


Likelihood Ratio Test

The likelihood ratio test (LRT) compares the maximized likelihood under the null hypothesis to the maximized likelihood under the alternative (unconstrained).

Motivation

  • If H0H_0H0​ is true, the likelihood at the constrained MLE (under H0H_0H0​) should be nearly as high as the unconstrained MLE.

  • If H0H_0H0​ is false, the unconstrained MLE will yield a substantially larger likelihood.

Test Statistic

Let ℓn(θ)=log⁡Ln(θ)\ell_n(\theta) = \log L_n(\theta)ℓn​(θ)=logLn​(θ) be the log-likelihood. Define:

  • θ^nMLE\hat{\theta}_n^{\text{MLE}}θ^nMLE​ : unconstrained MLE (maximizes ℓn\ell_nℓn​ over all θ\thetaθ in the full parameter space).

  • θ^nc\hat{\theta}_n^cθ^nc​ : constrained MLE (maximizes ℓn\ell_nℓn​ subject to H0H_0H0​).

The likelihood ratio statistic is

Tn=2[ℓn(θ^nMLE)−ℓn(θ^nc)]T_n = 2 \left[ \ell_n(\hat{\theta}_n^{\text{MLE}}) - \ell_n(\hat{\theta}_n^c) \right]Tn​=2[ℓn​(θ^nMLE​)−ℓn​(θ^nc​)]
  • By definition, Tn≥0T_n \geq 0Tn​≥0 (the unconstrained MLE always has log-likelihood at least as high).

  • Under H0H_0H0​ and regularity conditions, Tn→dχr2T_n \xrightarrow{d} \chi^2_rTn​d​χr2​, where rrr is the difference in dimensionality between the full parameter space and the null subspace.

Degrees of Freedom

  • If H0H_0H0​ imposes rrr independent restrictions (e.g., fixing rrr parameters to specific values), then rrr is the number of degrees of freedom for the chi-squared limit.

  • Example: Testing H0:θ2=1,θ3=2H_0: \theta_2 = 1, \theta_3 = 2H0​:θ2​=1,θ3​=2 in a 3-dimensional model (free parameter θ1\theta_1θ1​). The full space has dimension 3, the null has dimension 1, so r=3−1=2r = 3 - 1 = 2r=3−1=2.

Comparison with Wald Test

  • For Gaussian linear models, the Wald test and LRT are algebraically equivalent.

  • In general, they differ but have the same asymptotic chi-squared distribution under H0H_0H0​.

  • The LRT is often more reliable in finite samples, but the Wald test is easier to compute (requires only the MLE and its asymptotic variance).


Testing Functions of Parameters

Often we want to test hypotheses about a function g(θ)g(\theta)g(θ) rather than θ\thetaθ itself (e.g., θ1−θ2=0\theta_1 - \theta_2 = 0θ1​−θ2​=0).

Delta Method

If θ^n\hat{\theta}_nθ^n​ is an estimator (not necessarily MLE) satisfying

n(θ^n−θ)→dN(0,Σ(θ))\sqrt{n}(\hat{\theta}_n - \theta) \xrightarrow{d} N(0, \Sigma(\theta))n​(θ^n​−θ)d​N(0,Σ(θ))

then for a differentiable function g:Rd→Rkg: \mathbb{R}^d \to \mathbb{R}^kg:Rd→Rk (k≪dk \ll dk≪d)

n(g(θ^n)−g(θ))→dN(0,∇g(θ)⊤Σ(θ)∇g(θ))\sqrt{n}(g(\hat{\theta}_n) - g(\theta)) \xrightarrow{d} N\left(0, \nabla g(\theta)^\top \Sigma(\theta) \nabla g(\theta)\right)n​(g(θ^n​)−g(θ))d​N(0,∇g(θ)⊤Σ(θ)∇g(θ))

where ∇g\nabla g∇g is the d×kd \times kd×k Jacobian matrix of partial derivatives.

Wald-Type Test for g(θ)g(\theta)g(θ)

To test H0:g(θ)=0H_0: g(\theta) = 0H0​:g(θ)=0 against H1:g(θ)≠0H_1: g(\theta) \neq 0H1​:g(θ)=0:

  • The test statistic is

    Tn=n g(θ^n)⊤(∇g(θ^n)⊤Σ^∇g(θ^n))−1g(θ^n)T_n = n \, g(\hat{\theta}_n)^\top \left( \nabla g(\hat{\theta}_n)^\top \hat{\Sigma} \nabla g(\hat{\theta}_n) \right)^{-1} g(\hat{\theta}_n)Tn​=ng(θ^n​)⊤(∇g(θ^n​)⊤Σ^∇g(θ^n​))−1g(θ^n​)
  • Under H0H_0H0​, Tn→dχk2T_n \xrightarrow{d} \chi^2_kTn​d​χk2​.

  • This is a direct generalization of the Wald test for vector-valued functions.

One-dimensional special case: When k=1k=1k=1, this reduces to checking whether ng(θ^n)/∇g(θ^)⊤Σ(θ)∇g(θ^)\sqrt{n} g(\hat{\theta}_n) / \sqrt{\nabla g(\hat{\theta})^\top \Sigma(\theta) \nabla g(\hat{\theta})}n​g(θ^n​)/∇g(θ^)⊤Σ(θ)∇g(θ^)​ exceeds a normal quantile (or equivalently, the squared value exceeds χ12\chi^2_1χ12​ quantile). This is exactly the usual z-test.


Summary Table of Tests

  • Wald Test: Uses MLE and Fisher information; statistic is quadratic form; asymptotic χd2\chi^2_dχd2​ under H0H_0H0​ when testing all ddd parameters.

  • Likelihood Ratio Test: Uses difference of log-likelihoods; requires both constrained and unconstrained MLE; asymptotic χr2\chi^2_rχr2​ where rrr is number of restrictions.

  • Delta Method Test: For functions g(θ)g(\theta)g(θ); uses plug-in estimator of asymptotic variance; asymptotic χk2\chi^2_kχk2​ where kkk is dimension of ggg.

All three tests are asymptotically equivalent under the null and local alternatives, but they may differ in finite samples. The choice depends on computational convenience and the specific hypothesis structure.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent