Tutorials › Statistical Theory III - Theories of Inference, Multivariate Methods, and Contingency Tables › Common Errors in Constructing Exact t and F Tests

t and F Inference · Tutorial 245 of 972

Common Errors in Constructing Exact t and F Tests

Learn how to check whether an exact t or F test is defined, has the right degrees of freedom, and matches the hypothesis and model comparison.

Intermediate 10 min read

What You'll Learn

  • Check whether a contrast is estimable before testing it
  • Distinguish residual degrees of freedom from restriction rank
  • Count independent restrictions to set the numerator degrees of freedom
  • Choose a tail from the alternative hypothesis
  • Recognize why a partial F test requires nested models

Why Exact Tests Are Easy to Misconstruct

An exact \(t\) or \(F\) test is not made exact merely by using a familiar formula. Its calibration depends on the model, the estimability of the hypothesis, the number of independent restrictions, and the way the models are compared. A mismatch at any of these steps can produce a statistic that looks plausible but does not have the claimed reference distribution.

Throughout, use the normal linear model \(Y=X\beta+\varepsilon\), with \(Y\) an \(n\)-vector, \(X\) a fixed design matrix of rank \(p\), and \(\varepsilon\sim N(0,\sigma^2 I_n)\), where \(\sigma^2>0\). Thus \(n>p\) is needed for a positive residual degrees of freedom. Unless stated otherwise, tests below concern a feasible linear null hypothesis \(C\beta=d\), with \(C\) having \(q\) independent rows. The full-column-rank assumption ensures that every linear contrast of \(\beta\) is estimable.

Definition: A contrast \(a'\beta\) is estimable if it is determined by the distribution of the observations, or equivalently, if \(a'\beta\) has the same value for every parameter vector producing the same mean \(X\beta\). For a general design matrix, this is equivalent to \(a'\) belonging to the row space of \(X\). A set of restrictions is estimable when each restriction is estimable.

First Check: Is the Hypothesis Estimable?

A coefficient vector need not be identifiable just because a model has been written with named coefficients. If \(X\) is rank deficient, distinct coefficient vectors can give exactly the same fitted mean. A test of a nonestimable contrast cannot be recovered from the data: its value changes while the distribution of \(Y\) stays fixed.

Worked Example: A Coefficient That Cannot Be Tested

Suppose the design has three columns: an intercept and two identical predictor columns. For three observations, write \(X=\begin{pmatrix}1&0&0\\1&1&1\\1&2&2\end{pmatrix}\). The mean vector is \((\beta_0,\ \beta_0+\beta_1+\beta_2,\ \beta_0+2\beta_1+2\beta_2)'\).

The coefficient vectors \((0,1,0)'\) and \((0,0,1)'\) produce the same mean vector, namely \((0,1,2)'\). But their values of \(\beta_1\) are 1 and 0. Therefore \(\beta_1\) is not determined by the distribution of \(Y\), and a test of \(\beta_1=0\) is not a valid test of an estimable contrast.

In contrast, \(\beta_1+\beta_2\) is determined by the mean. The data identify the combined contribution of the two identical columns, even though they do not identify the two coefficients separately. The correction is to formulate a hypothesis in terms of an estimable contrast, or to reparameterize the model so that the identifiable quantity is explicit.

In a rank-deficient design, checking whether a contrast is estimable must come before calculating a standard error or an \(F\) statistic. A generalized inverse in a formula does not make a nonestimable contrast estimable; different coefficient representations may give different answers for that contrast.

Degrees of Freedom: Two Different Counts

The denominator degrees of freedom in the standard exact tests come from the unrestricted residual sum of squares. With \(\operatorname{rank}(X)=p\), it is \(n-p\), not \(n-1\) unless \(p=1\). The numerator degrees of freedom for a general linear hypothesis come from the number of independent restrictions, not simply the number of rows printed in \(C\).

Key distinction: For a full-rank design and \(q\) independent, estimable restrictions, the exact general linear hypothesis \(F\) test uses numerator degrees of freedom \(q\) and denominator degrees of freedom \(n-p\). Redundant restrictions do not increase \(q\); fitted model dimension determines \(n-p\).

Worked Example: Redundant Restrictions and Residual Degrees of Freedom

Suppose \(n=12\), the unrestricted design has rank \(p=4\), and the written restriction matrix is \(C=\begin{pmatrix}1&0&0&0\\0&1&0&0\\1&1&0&0\end{pmatrix}\). The third row is the sum of the first two, so \(\operatorname{rank}(C)=2\), not 3. The correct numerator degrees of freedom are \(q=2\), while the denominator degrees of freedom are \(12-4=8\).

If \(\mathrm{SSE}_U=80\) and imposing these restrictions increases the residual sum of squares by 20, then \(F=(20/2)/(80/8)=10/10=1\). The calculation uses two independent restrictions and eight unrestricted residual degrees of freedom. Using 3 in the numerator would count a redundant restriction; using \(12-2\) in the denominator would confuse the restriction count with the fitted model rank.

The restriction rank can also be understood geometrically. In a full-rank \(p\)-parameter model, \(q\) independent restrictions reduce the dimension of the allowed coefficient set from \(p\) to \(p-q\). The difference in dimensions is the numerator degrees of freedom. This reasoning is about independent constraints, not the number of coefficients that happen to appear in the hypothesis.

Why the Exact Partial \(F\) Test Works for Affine Restrictions

A subtle error arises when the null is \(C\beta=d\) with \(d\ne0\). The set of restricted mean vectors is then generally an affine set, not a linear subspace through the origin. A projection-matrix argument that treats it as a linear subspace can give an incorrect sum-of-squares identity. The affine form below keeps track of the offset.

Theorem: Suppose \(Y\sim N(X\beta,\sigma^2 I_n)\), \(X\) has rank \(p<n\), and \(C\beta=d\) is feasible with \(C\) of rank \(q\). Let \(\mathrm{SSE}_U\) and \(\mathrm{SSE}_R\) be the unrestricted and restricted residual sums of squares. Under \(H_0:C\beta=d\), $$ F=\frac{(\mathrm{SSE}_R-\mathrm{SSE}_U)/q}{\mathrm{SSE}_U/(n-p)} \sim F_{q,n-p}. $$

Proof. Let \(M=\operatorname{col}(X)\), and let \(L=\{Xb:Cb=0\}\), the direction subspace of the restricted mean set. Choose any \(\mu_0=X\beta_0\) satisfying \(C\beta_0=d\). Then the restricted mean set is \(\mu_0+L\). Write \(P_M\) and \(P_L\) for the orthogonal projection matrices onto \(M\) and \(L\), respectively. Since \(L\subset M\), the difference \(P_M-P_L\) is the projection onto the part of \(M\) orthogonal to \(L\).

For \(z=Y-\mu_0\), least squares over the affine set \(\mu_0+L\) gives \(\mathrm{SSE}_R=z'(I-P_L)z\). Since \(\mu_0\in M\), least squares over \(M\) gives \(\mathrm{SSE}_U=z'(I-P_M)z\). Subtracting these identities yields

$$ \mathrm{SSE}_R-\mathrm{SSE}_U =z'(P_M-P_L)z. $$

Under the null, the true mean \(\mu=X\beta\) belongs to \(\mu_0+L\), so \(\mu-\mu_0\in L\). The projection \(P_M-P_L\) annihilates every vector in \(L\). Consequently the numerator sum of squares divided by \(\sigma^2\) is the squared length of the projection of a standard normal vector onto a \(q\)-dimensional subspace, and hence has a \(\chi^2_q\) distribution. Here \(\dim(M)=p\) and \(\dim(L)=p-q\), so the difference subspace has dimension \(q\).

Also, \(\mathrm{SSE}_U/\sigma^2\) is the squared length of the projection of the error onto \(M^\perp\), which has dimension \(n-p\), and thus has a \(\chi^2_{n-p}\) distribution. The two projections are onto orthogonal subspaces. For a multivariate normal vector, orthogonal projections are independent, so these two chi-square variables are independent. Their ratio after division by their respective degrees of freedom has the stated \(F_{q,n-p}\) distribution. \(\square\)

The affine offset matters in the derivation: the residual from the restricted fit is formed from \(Y-\mu_0\), not from \(Y\) as though the restricted set passed through zero. The result applies to nonzero \(d\) because the null mean differs from \(\mu_0\) only in a direction that is removed by the relevant projection.

Tail Choice Must Match the Alternative

Under an alternative \(C\beta\ne d\), \((\mathrm{SSE}_R-\mathrm{SSE}_U)/\sigma^2\) has a noncentral \(\chi^2_q\) distribution with positive noncentrality parameter, so the general \(F\) test uses an upper-tail rejection region. For a scalar contrast, the signed \(t\) statistic retains the direction of the departure: a two-sided alternative uses both tails, while a one-sided alternative uses the tail indicated by its direction.

Worked Example: A Directional Alternative Is Not Two-Sided

Suppose a scalar contrast has estimate \(2.4\), estimated standard error \(0.8\), and residual degrees of freedom 10. To test \(H_0:\theta=0\) against \(H_1:\theta>0\), the observed statistic is \(t=2.4/0.8=3\). The rejection region is in the upper tail of a \(t_{10}\) distribution, and the \(p\)-value is \(P(T_{10}\ge3)\).

If the alternative were \(H_1:\theta\ne0\), the \(p\)-value would instead be \(2P(T_{10}\ge |3|)\), using the symmetry of the \(t\) distribution. These are not the same test: choosing the two-sided calculation when the stated alternative is one-sided changes the \(p\)-value, while choosing a one-sided tail after seeing the sign of the estimate does not preserve the intended test.

For one restriction, the corresponding \(F\) statistic is \(t^2=9\), and its \(F_{1,10}\) upper-tail probability matches the two-sided \(t_{10}\) probability. Squaring removes the sign, so this \(F\) test does not encode a directional alternative.

A common mistake is to report an upper-tail \(F\) probability for a negative signed \(t\) statistic in a one-sided test without checking the direction. The correction is to state the alternative first, compute the signed \(t\) statistic, and select the tail accordingly. A general \(F\) test is nondirectional; use a signed contrast test when a directional claim is the scientific question.

Partial \(F\) Tests Require Nested Models

The increase \(\mathrm{SSE}_R-\mathrm{SSE}_U\) has the required projection and degrees-of-freedom interpretation when the restricted model is nested within the unrestricted model. In the general linear hypothesis setup, the restricted mean set is a subset of the unrestricted mean space. Comparing two unrelated fitted models does not automatically create a partial \(F\) statistic, even if both fits use least squares and the same response.

Worked Example: Two Nonnested Models Can Reverse the SSE Difference

Consider three observations and two distinct one-dimensional model spaces: the intercept-only space \(M_A=\operatorname{span}\{(1,1,1)'\}\), and the through-origin slope space \(M_B=\operatorname{span}\{(1,0,-1)'\}\). Neither space contains the other. For \(y=(1,0,1)'\), the intercept fit has mean \(2/3\), so \(\mathrm{SSE}_A=(1-2/3)^2+(0-2/3)^2+(1-2/3)^2=2/3\). The dot product of \(y\) with \((1,0,-1)'\) is zero, so the slope fit is zero and \(\mathrm{SSE}_B=1^2+0^2+1^2=2\).

For \(y=(1,0,-1)'\), the intercept fit is zero and \(\mathrm{SSE}_A=2\). The through-origin slope model fits exactly, since \(y\) lies in \(M_B\), so \(\mathrm{SSE}_B=0\). Thus which model has the smaller SSE depends on the observed response; there is no fixed nonnegative “extra sum of squares” from treating one as a restriction of the other. A partial \(F\) test cannot be justified by subtracting these unrelated SSEs. Formulate a nested-model hypothesis or use a method designed for the actual comparison.

Practical Checks Before Reporting a Test

The errors discussed here are avoidable if the test is audited in a fixed order. First identify the model and verify that the hypothesis concerns estimable quantities. Next determine how many independent restrictions are imposed and confirm that the restricted model is nested in the unrestricted one. Then identify the residual degrees of freedom from the unrestricted fit and select the tail dictated by the alternative.

1
Check estimability.
Verify that every contrast in the null is determined by the design. Do not test an unidentified coefficient separately from aliased coefficients.
2
Count independent restrictions.
Compute the rank of the restriction matrix after expressing the hypothesis in identifiable parameters. This rank supplies the numerator degrees of freedom.
3
Check model nesting and residual degrees of freedom.
A partial test compares nested mean spaces; the denominator degrees of freedom are \(n-p\) for the unrestricted model of rank \(p\).
4
Match the tail to the alternative.
Use an upper-tail \(F\) test for a general departure, and use the sign and stated direction for a one-sided scalar \(t\) test.

The central lesson is that an exact reference distribution is conditional on the structure of the problem, not just a formula. Estimability determines whether the hypothesis is testable; restriction rank and residual degrees of freedom determine the calibration; nesting justifies the partial sum-of-squares comparison; and the alternative determines the tail.

Check Your Understanding

Use the model assumptions and distinctions in this tutorial to answer the following.

  1. In a rank-deficient design, what condition must a scalar contrast satisfy to be estimable?
  2. A hypothesis matrix has five rows but rank three. How many numerator degrees of freedom does the corresponding general linear hypothesis test use?
  3. For an unrestricted model with \(n=20\) observations and design rank \(p=6\), what are the residual degrees of freedom?
  4. Why does a general \(F\) test use an upper-tail rejection region, while a one-sided scalar \(t\) test must retain the sign of its statistic?
  5. What feature of two models is needed before their SSE difference can be interpreted as a partial-test numerator?
Clinical Biostats