Tutorials › Generalized Linear Models › The Exact F Test in Gaussian Linear Models

Nested Models and Deviance Tests · Tutorial 314 of 981

The Exact F Test in Gaussian Linear Models

Learn how nested-model residual sums of squares produce an exact F test under Gaussian errors, and how that test connects to likelihood-ratio deviance and its large-sample chi-square limit.

Intermediate 12 min read

What You'll Learn

  • State the assumptions that make a nested Gaussian linear-model F test exact
  • Derive the test statistic from the two models’ residual sums of squares
  • Relate the F statistic to the likelihood-ratio statistic with unknown variance
  • Distinguish known-variance and unknown-variance likelihood comparisons
  • Explain why the likelihood-ratio statistic approaches a chi-square distribution
  • Identify common errors in degrees of freedom and test calibration

Why the Exact F Test Is Special

For nested models, a likelihood-ratio comparison asks whether the larger model improves the fit enough to justify its additional parameters. In a general GLM, the reference distribution is often an approximation. In a Gaussian linear model with independent normal errors and a common variance, the comparison has a stronger result: its familiar partial F statistic has an exact finite-sample F distribution under the null hypothesis.

The exact result depends on the Gaussian model and on estimating the same variance in both models. It is not a general property of nested-model deviance tests. We will derive the F statistic from orthogonal projections, then show how it is related to the likelihood-ratio statistic and its large-sample chi-square approximation.

Model Setup and Test Statistic

Definition: Let \(y\) be an \(n\)-vector of responses and consider the Gaussian linear model \(y\sim N(X_1\beta_1,\sigma^2 I_n)\), where \(X_1\) has rank \(p_1\), \(\sigma^2>0\), and the design matrix is fixed. A reduced model is nested in this full model when its mean space is a subspace of the full model’s mean space. Write the reduced design matrix as \(X_0\), with rank \(p_0\), and assume \(\mathcal C(X_0)\subseteq\mathcal C(X_1)\). The null hypothesis is that the mean lies in \(\mathcal C(X_0)\). Set \(q=p_1-p_0\) and \(\nu=n-p_1\), and assume \(q>0\) and \(\nu>0\).

Here \(\mathcal C(X)\) denotes the column space of \(X\). The full model adds \(q\) independent dimensions to the reduced model. Let \(P_j\) be the orthogonal projection matrix onto \(\mathcal C(X_j)\). The residual sum of squares for model \(j\) is \(RSS_j=y^\mathsf{T}(I_n-P_j)y\). Because the models are nested, fitting the full model cannot increase the residual sum of squares, so \(RSS_0-RSS_1\geq 0\).

Definition: The partial F statistic for comparing the reduced model with the full model is
$$ F=\frac{(RSS_0-RSS_1)/q}{RSS_1/\nu}. $$
The numerator is the reduction in residual sum of squares per added model dimension; the denominator is the full model’s residual mean square.

This statistic tests whether the added dimensions explain more variation than would be expected from the full model’s residual variation. The degrees of freedom are \(q\) in the numerator and \(n-p_1\) in the denominator—not \(n-p_0\). The denominator uses the full model’s residual sum of squares because that model is the one used to estimate the common variance after allowing for the added terms.

Worked Example: Testing One Added Regression Term

Take \(n=6\), with reduced model containing an intercept and full model containing an intercept and the predictor \(x=(-1,-1,0,0,1,1)^\mathsf{T}\). The observed responses are \(y=10\mathbf 1+2x+e\), where \(e=(1,-1,-1,1,0,0)^\mathsf{T}\). Compare the two models.

The vectors satisfy \(\mathbf 1^\mathsf{T}x=0\), \(\mathbf 1^\mathsf{T}e=0\), and \(x^\mathsf{T}e=0\). Thus the intercept, predictor contribution, and residual vector are mutually orthogonal. Also, \(x^\mathsf{T}x=4\) and \(e^\mathsf{T}e=4\). The reduced model fits the intercept but not the predictor, so its residual is \(2x+e\), giving

$$ RSS_0=(2x+e)^\mathsf{T}(2x+e)=4x^\mathsf{T}x+e^\mathsf{T}e=16+4=20. $$

The full model fits both the intercept and \(2x\), leaving residual \(e\), so \(RSS_1=4\). Here \(p_0=1\), \(p_1=2\), \(q=1\), and \(\nu=6-2=4\). Therefore

$$ F=\frac{(20-4)/1}{4/4}=16. $$

Under the null hypothesis this is compared with an \(F_{1,4}\) distribution. Its upper-tail probability is approximately \(0.0161\). This is a finite-sample test under the model assumptions, not a chi-square approximation.

Why the F Distribution Is Exact

The exact result follows from the geometry of nested projections and the distribution of Gaussian quadratic forms. The assumptions are important: conditional on the fixed design, the errors must be independent normal variables with mean zero and common variance \(\sigma^2\). Under the null, the true mean must lie in the reduced model’s column space.

Theorem: Under the model and rank assumptions above, and under the null hypothesis that \(E[y]\in\mathcal C(X_0)\), the partial F statistic has the exact distribution \(F\sim F_{q,\nu}\). The two sums of squares \(RSS_0-RSS_1\) and \(RSS_1\) are independent.

To prove the result, write \(P_0\) and \(P_1\) for the two projection matrices. Since the spaces are nested, \(A=P_1-P_0\) is a symmetric idempotent matrix with rank \(q\). Also \(B=I_n-P_1\) is symmetric and idempotent with rank \(\nu\). The projections are onto orthogonal spaces, so \(AB=0\). Under the null, the mean \(\mu=E[y]\) lies in \(\mathcal C(X_0)\), and hence \(A\mu=B\mu=0\).

1
Express the sums of squares as quadratic forms.
Since \(y^\mathsf{T}P_jy\) is the fitted sum of squares, \(RSS_0-RSS_1=y^\mathsf{T}(P_1-P_0)y=y^\mathsf{T}Ay\), and \(RSS_1=y^\mathsf{T}(I_n-P_1)y=y^\mathsf{T}By\).
2
Use the Gaussian quadratic-form result.
Under the null, \(y=\mu+\varepsilon\), with \(\varepsilon\sim N(0,\sigma^2 I_n)\), and \(A\mu=B\mu=0\). A symmetric idempotent quadratic form in a spherical normal vector, divided by \(\sigma^2\), has a chi-square distribution with degrees of freedom equal to its rank. Therefore \((RSS_0-RSS_1)/\sigma^2\sim\chi^2_q\) and \(RSS_1/\sigma^2\sim\chi^2_\nu\). Because \(AB=0\), the two forms are independent (the Gaussian orthogonal-projection, or Cochran, result).
3
Form the ratio.
Dividing each independent chi-square variable by its degrees of freedom gives independent variables with distributions \(\chi^2_q/q\) and \(\chi^2_\nu/\nu\). Their ratio is \(F_{q,\nu}\), which is exactly the statistic \(F\) defined above. □

The same projection argument also describes power under an alternative. If the true mean has a component outside \(\mathcal C(X_0)\), the numerator quadratic form has a noncentral chi-square distribution, with noncentrality parameter \(\mu^\mathsf{T}A\mu/\sigma^2\); it remains independent of \(RSS_1\). The resulting statistic has a noncentral F distribution. Under the null this parameter is zero, giving the central F distribution in the theorem.

Worked Example: Testing a Two-Parameter Block

Suppose \(n=6\), the reduced model contains an intercept, and the full model adds two predictors \(x_1=(1,-1,0,0,0,0)^\mathsf{T}\) and \(x_2=(1,1,-2,0,0,0)^\mathsf{T}\). Let \(y=5\mathbf 1+2x_1+x_2+e\), where \(e=(0,0,0,1,-1,0)^\mathsf{T}\). These three added components are orthogonal to the intercept and to each other. In particular, \(x_1^\mathsf{T}x_1=2\), \(x_2^\mathsf{T}x_2=6\), and \(e^\mathsf{T}e=2\).

The reduced model leaves residual \(2x_1+x_2+e\). Orthogonality gives \(RSS_0=4(2)+1(6)+2=16\). The full model leaves only \(e\), so \(RSS_1=2\). Here \(q=2\), \(p_1=3\), and \(\nu=6-3=3\). Thus

$$ F=\frac{(16-2)/2}{2/3}=\frac{7}{2/3}=10.5. $$

The exact reference distribution is \(F_{2,3}\). For these degrees of freedom, the upper-tail probability at \(10.5\) is \(\left(3/(3+2(10.5))\right)^{3/2}=(1/8)^{3/2}\approx0.0442\). The test concerns the two added dimensions jointly; it is not two separate one-degree-of-freedom tests.

Connection to Likelihood-Ratio Deviance

The F test is closely related to the likelihood-ratio comparison, but the relationship depends on whether the common variance is known or estimated. Define the likelihood-ratio statistic in the direction that is nonnegative as \(2\{\ell_1-\ell_0\}\), where each log-likelihood is maximized over the parameters allowed by its model.

If \(\sigma^2\) is known, least squares maximizes the Gaussian likelihood over the regression coefficients. Substituting the fitted coefficients into the log-likelihood shows that the terms common to both models cancel, leaving

$$ 2\{\ell_1-\ell_0\}=\frac{RSS_0-RSS_1}{\sigma^2}. $$

Under the null this known-variance likelihood-ratio statistic has an exact \(\chi^2_q\) distribution, by the quadratic-form result above. This is not the same statistic as the usual F test, which estimates variance from the full model.

When the common variance is unknown, maximize the Gaussian likelihood over both regression coefficients and \(\sigma^2\) separately in each model. For model \(j\), the fitted coefficients minimize \(RSS_j\), and the maximum-likelihood estimate of the variance is \(RSS_j/n\). Provided the residual sums of squares are positive, the maximized log-likelihood is

$$ \ell_j=-\frac n2\left\{\log(2\pi)+1+\log(RSS_j/n)\right\}. $$

Consequently, the profiled likelihood-ratio statistic is

$$ 2\{\ell_1-\ell_0\}=n\log\left(\frac{RSS_0}{RSS_1}\right). $$

This expression is not generally equal to the partial F statistic. However, since \(F=((RSS_0-RSS_1)/q)/(RSS_1/\nu)\), the two are related exactly by

$$ 2\{\ell_1-\ell_0\}=n\log\left(1+\frac{qF}{\nu}\right). $$

For fixed \(n,q,\nu\), this is a strictly increasing function of \(F\). Thus, when both comparisons use the same likelihood and the same assumptions, they rank the data in the same way: a larger F statistic gives a larger likelihood-ratio statistic. But for exact finite-sample inference with unknown variance, use the \(F_{q,\nu}\) reference distribution, not a chi-square distribution for the profiled statistic.

Worked Example: Known Versus Estimated Variance

Return to the one-predictor example, where \(RSS_0=20\), \(RSS_1=4\), \(q=1\), \(\nu=4\), and \(n=6\). If the variance is known to be \(\sigma^2=4\), the likelihood-ratio statistic is

$$ 2\{\ell_1-\ell_0\}=(20-4)/4=4. $$

Under the null this has an exact \(\chi^2_1\) distribution. If instead the variance is unknown, the profiled likelihood-ratio statistic is \(6\log(20/4)=6\log(5)\approx9.657\). The partial F statistic is \(16\), and the relationship checks:

$$ 6\log\left(1+\frac{1(16)}{4}\right)=6\log(5)\approx9.657. $$

The statistics and their reference distributions differ because the variance is treated differently. With unknown variance, the exact test here uses \(F_{1,4}\), not a chi-square reference distribution for \(9.657\).

Large-Sample Chi-Square Limit

The F comparison connects to the chi-square likelihood-ratio approximation used more broadly for nested models. In the Gaussian setting, the limit can be seen directly from the exact distribution. Hold \(q\) fixed and let \(\nu\) grow. If \(U\sim\chi^2_q\) and \(V\sim\chi^2_\nu\) are independent, then \(F=(U/q)/(V/\nu)\). Since \(E[V/\nu]=1\) and \(\operatorname{Var}(V/\nu)=2/\nu\), \(V/\nu\xrightarrow{p}1\). Slutsky’s theorem therefore gives

$$ qF=\frac{U}{V/\nu}\xrightarrow{d}\chi^2_q. $$

For the profiled likelihood-ratio statistic, suppose \(q\) is fixed and \(p_1\) is fixed as \(n\) grows, so \(\nu=n-p_1\) and \(n/\nu\to1\). Under the null, \(F=O_p(1)\), and therefore \(qF/\nu=O_p(1/\nu)\). Using \(\log(1+x)=x+O(x^2)\) as \(x\to0\), we obtain

$$ n\log\left(1+\frac{qF}{\nu}\right) =\frac{n}{\nu}qF+O_p\left(\frac{n}{\nu^2}\right) =qF+o_p(1) \xrightarrow{d}\chi^2_q. $$

This is the large-sample chi-square limit. It explains how the profiled likelihood-ratio comparison and the exact F comparison align asymptotically. The limit requires increasing residual degrees of freedom under the conditions stated; it does not turn the finite-sample F distribution into a chi-square distribution at small sample sizes.

Common Pitfalls and Practical Meaning

  • Using the wrong denominator degrees of freedom. The residual mean square is \(RSS_1/(n-p_1)\), so the denominator degrees of freedom are \(n-p_1\), from the full model.
  • Treating every deviance difference as an exact F test. The exact F result depends on Gaussian errors, a common variance, nesting, and the stated rank conditions. It does not apply automatically to other GLMs.
  • Confusing known and unknown variance likelihood ratios. With known variance, the likelihood-ratio statistic is \((RSS_0-RSS_1)/\sigma^2\). With unknown variance profiled separately, it is \(n\log(RSS_0/RSS_1)\). The exact unknown-variance test uses the F statistic.
  • Using the chi-square approximation in a small sample without checking. A chi-square limit is a large-sample result. When the Gaussian assumptions hold, the F reference distribution gives the exact finite-sample calibration.
  • Comparing models that are not nested or do not share a common likelihood. The projection decomposition and the likelihood-ratio relationship require a valid nested comparison under the same response model.

The exact F test is useful because it turns a nested Gaussian comparison into a finite-sample test with a known null distribution. The likelihood-ratio connection clarifies how this special case fits into the broader theory of deviance comparisons: the same improvement in fit can be expressed through residual sums of squares, while the appropriate calibration depends on whether variance is known, estimated exactly, or approximated asymptotically.

Check Your Understanding

Use the assumptions and relationships developed above to answer these questions.

  1. For a reduced model of rank \(p_0\) and a full model of rank \(p_1\), state the numerator and denominator degrees of freedom of the exact F test.
  2. Why are \(RSS_0-RSS_1\) and \(RSS_1\) independent under the null in the Gaussian linear model?
  3. With unknown common variance, write the profiled likelihood-ratio statistic as a function of the partial F statistic.
  4. What assumptions allow the partial F statistic to have an exact finite-sample distribution?
  5. Explain why the profiled likelihood-ratio statistic approaches a \(\chi^2_q\) distribution when \(q\) and \(p_1\) are fixed and \(n\) grows.
Clinical Biostats