Tutorials › Statistical Theory III - Theories of Inference, Multivariate Methods, and Contingency Tables › Corrected and Uncorrected Total Sums of Squares

Cochran's Theorem and Sums-of-Squares Decompositions · Tutorial 203 of 972

Corrected and Uncorrected Total Sums of Squares

Learn to identify the projection underlying each total sum of squares and to decompose the data vector appropriately when a model includes an intercept.

Intermediate 11 min read

What You'll Learn

  • Define corrected and uncorrected total sums of squares as quadratic forms.
  • Identify the subspaces onto which their projection matrices project.
  • Relate the two sums through the projection onto the constant-vector space.
  • Explain why including an intercept gives a centered model decomposition.
  • Determine the relevant noncentral chi-square distributions under spherical normality.
  • Avoid treating corrected and uncorrected sums of squares as interchangeable.

Two Different Reference Points

A sum of squares measures squared length, but its value depends on the reference point. For an observation vector \(y=(y_1,\ldots,y_n)^\mathsf{T}\), the quantity \(y^\mathsf{T}y\) measures squared distance from the zero vector. By contrast, the corrected total sum of squares measures squared distance from the constant vector whose entries equal the sample mean. These are different reference points, so the two quantities need not agree.

This distinction is important in normal-theory inference and in linear models. A projection matrix makes the geometry explicit: the uncorrected sum is associated with the whole observation space, while the corrected sum is associated with the subspace perpendicular to the constant vector. Including an intercept in a model allows its fitted space to separate the constant component from the remaining variation.

Definition: Let \(y\in\mathbb{R}^n\), let \(\mathbf{1}\) denote the \(n\)-vector of ones, and define the sample mean \(\bar y=\mathbf{1}^\mathsf{T}y/n\). The uncorrected total sum of squares is \(y^\mathsf{T}y=\sum_{i=1}^n y_i^2\). The corrected total sum of squares is \(\sum_{i=1}^n(y_i-\bar y)^2\).

The word “corrected” indicates that the deviations are measured after removing the sample mean. It does not mean that one quantity is universally more accurate than the other. If the natural reference value is zero, the uncorrected sum may be the relevant quantity. If the reference is the sample mean, the corrected sum is the relevant one.

The Projection Matrices

Write \(I_n\) for the \(n\times n\) identity matrix and define

$$ J=\frac{\mathbf{1}\mathbf{1}^\mathsf{T}}{n}, \qquad C=I_n-J. $$

The matrix \(J\) is the orthogonal projection onto \(\operatorname{span}(\mathbf{1})\), the space of constant vectors. Indeed, for any \(y\), \(Jy=\bar y\mathbf{1}\). The matrix \(C\) is the orthogonal projection onto \(\operatorname{span}(\mathbf{1})^\perp\), the set of vectors whose entries sum to zero. Both matrices are symmetric and idempotent: \(J^\mathsf{T}=J\), \(J^2=J\), \(C^\mathsf{T}=C\), and \(C^2=C\).

For any symmetric idempotent matrix \(A\), \(y^\mathsf{T}Ay=(Ay)^\mathsf{T}(Ay)=\|Ay\|^2\). Thus a quadratic form with a projection matrix is the squared length of the projected vector. In particular, \(I_n\) projects onto all of \(\mathbb{R}^n\), whereas \(C\) removes the component in the constant-vector direction.

Theorem: The uncorrected total sum of squares is \(y^\mathsf{T}I_n y\), the squared length of the projection onto \(\mathbb{R}^n\). The corrected total sum of squares is \(y^\mathsf{T}Cy\), the squared length of the projection onto \(\operatorname{span}(\mathbf{1})^\perp\). Consequently, $$ y^\mathsf{T}y = n\bar y^2+\sum_{i=1}^n(y_i-\bar y)^2. $$

To verify the identity, decompose \(y=Jy+Cy\). The two vectors are orthogonal because \(J\) and \(C\) project onto orthogonal subspaces. Their squared lengths are

$$ \|Jy\|^2 =\|\bar y\mathbf{1}\|^2 =n\bar y^2, \qquad \|Cy\|^2 =\sum_{i=1}^n(y_i-\bar y)^2. $$

The Pythagorean theorem gives the displayed equality. In matrix form, the same result follows from \(I_n=J+C\) and \(JC=0\). The ranks also differ: \(I_n\) has rank \(n\), while \(C\) has rank \(n-1\) for \(n\geq 1\).

Worked Example: Separating the Mean Component

Let \(y=(2,1,3,2)^\mathsf{T}\). Calculate both total sums of squares and verify their projection decomposition.

The sample mean is \(\bar y=(2+1+3+2)/4=2\). The uncorrected sum is \(y^\mathsf{T}y=2^2+1^2+3^2+2^2=18\). The centered vector is \(Cy=y-2\mathbf{1}=(0,-1,1,0)^\mathsf{T}\), so the corrected sum is \(0^2+(-1)^2+1^2+0^2=2\).

The projected constant component is \(Jy=2\mathbf{1}\), whose squared length is \(4(2^2)=16\). Therefore \(y^\mathsf{T}y=16+2=18\), as required. The corrected sum records only the part perpendicular to the constant-vector direction.

What Changes When a Model Includes an Intercept?

A model with an intercept has a mean space \(M\) containing \(\mathbf{1}\). This inclusion lets the fitted vector separate into a constant component and a component perpendicular to constants. To state this precisely, define \(M_0=M\cap\operatorname{span}(\mathbf{1})^\perp\). Then \(M\) is the orthogonal direct sum of \(\operatorname{span}(\mathbf{1})\) and \(M_0\).

For if \(v\in M\), then \(Jv\in\operatorname{span}(\mathbf{1})\subseteq M\), and \(Cv=v-Jv\) belongs to \(M\) and is perpendicular to \(\mathbf{1}\). Hence \(v=Jv+Cv\) is a sum of vectors in the two stated subspaces. Their intersection consists only of zero, so the sum is orthogonal and unique.

Result: If a model space \(M\) contains \(\mathbf{1}\), and \(P_M\) denotes its orthogonal projection, then $$ y^\mathsf{T}y = n\bar y^2 +\|P_{M_0}Cy\|^2 +\|(I_n-P_{M_0})Cy\|^2, \qquad M_0=M\cap\operatorname{span}(\mathbf{1})^\perp. $$ In particular, the corrected total sum of squares splits into the squared length projected onto \(M_0\) and the squared length perpendicular to \(M_0\) within the centered subspace.

Here \(P_{M_0}\) is the orthogonal projection onto \(M_0\). To prove the result, first write \(y=Jy+Cy\); these components are orthogonal. Since \(M_0\) is a subspace of \(\operatorname{span}(\mathbf{1})^\perp\), the two vectors \(P_{M_0}Cy\) and \((I_n-P_{M_0})Cy\) are also perpendicular to \(Jy\). They are perpendicular to each other by the projection property. Thus

$$ \|y\|^2 =\|Jy\|^2+\|P_{M_0}Cy\|^2 +\|(I_n-P_{M_0})Cy\|^2. $$

Substituting \(\|Jy\|^2=n\bar y^2\) proves the stated result. The intercept is what ensures this centered decomposition of the model space. Without it, the model space need not contain the constant direction, and its projection may mix constant and centered components.

Worked Example: A Model Without an Intercept

Let \(y=(3,1,2,0)^\mathsf{T}\), and consider the one-dimensional model space \(M=\operatorname{span}(x)\), where \(x=(1,0,-1,0)^\mathsf{T}\). Calculate the projection sum and residual squared length, and compare them with the corrected total.

Since \(x^\mathsf{T}x=2\) and \(x^\mathsf{T}y=1\), the projection is \(P_My=x(x^\mathsf{T}y)/(x^\mathsf{T}x)=x/2=(1/2,0,-1/2,0)^\mathsf{T}\). Its squared length is \((1/2)^2+(-1/2)^2=1/2\). The residual is \(y-P_My=(5/2,1,5/2,0)^\mathsf{T}\), with squared length \(25/4+1+25/4=27/2\). These add to \(1/2+27/2=14=y^\mathsf{T}y\).

The sample mean is \(3/2\), so the centered vector is \((3/2,-1/2,1/2,-3/2)^\mathsf{T}\), and the corrected total is \(9/4+1/4+1/4+9/4=5\). The model space does not contain \(\mathbf{1}\), and its projection sum \(1/2\) is not a component of the corrected total \(5\) in an orthogonal decomposition. The uncorrected projection decomposition still holds because \(M\) and its orthogonal complement partition the whole space.

Worked Example: The Same Direction With an Intercept

Use \(y=(3,1,2,0)^\mathsf{T}\) again, but now let \(M=\operatorname{span}(\mathbf{1},x)\), with \(x=(1,-1,0,0)^\mathsf{T}\). Find the centered model and verify the decomposition.

Here \(\mathbf{1}^\mathsf{T}x=0\), so \(M_0=\operatorname{span}(x)\). The sample mean is \(3/2\), and \(Cy=(3/2,-1/2,1/2,-3/2)^\mathsf{T}\). Because \(x^\mathsf{T}Cy=2\) and \(x^\mathsf{T}x=2\), \(P_{M_0}Cy=x\), whose squared length is \(2\). The remaining centered vector is \(Cy-x=(1/2,1/2,1/2,-3/2)^\mathsf{T}\), whose squared length is \(1/4+1/4+1/4+9/4=3\).

The corrected total is \(2+3=5\), and the intercept component has squared length \(n\bar y^2=4(3/2)^2=9\). Hence the full decomposition is \(y^\mathsf{T}y=9+2+3=14\). The intercept allows the model contribution beyond the constant component to be measured within the centered subspace.

Normal-Theory Distributions

Projection rank also determines the degrees of freedom in normal-theory quadratic forms. Suppose \(Y\sim N_n(\mu,\sigma^2 I_n)\), with \(\sigma^2>0\). A noncentral chi-square distribution with \(r\) degrees of freedom and noncentrality parameter \(\lambda\) is the distribution of the sum of squares of \(r\) independent normal variables with unit variance whose squared means sum to \(\lambda\).

Result: Under \(Y\sim N_n(\mu,\sigma^2 I_n)\), $$ \frac{Y^\mathsf{T}Y}{\sigma^2} \sim \chi^2_n\left(\frac{\mu^\mathsf{T}\mu}{\sigma^2}\right), \qquad \frac{Y^\mathsf{T}CY}{\sigma^2} \sim \chi^2_{n-1}\left(\frac{\mu^\mathsf{T}C\mu}{\sigma^2}\right). $$ The first distribution is central exactly when \(\mu=0\); the second is central exactly when \(\mu\) is constant across its \(n\) coordinates.

For justification, let \(A\) be either \(I_n\) or \(C\), with rank \(r\). Choose an orthogonal matrix \(Q\) that diagonalizes \(A\), so \(Q^\mathsf{T}AQ\) has \(r\) ones and \(n-r\) zeros on its diagonal. Orthogonal transformation gives \(Q^\mathsf{T}Y\sim N_n(Q^\mathsf{T}\mu,\sigma^2I_n)\), whose coordinates are independent. Therefore \(Y^\mathsf{T}AY/\sigma^2\) is the sum of squares of the first \(r\) transformed coordinates after division by \(\sigma\). Their squared means sum to \(\mu^\mathsf{T}A\mu/\sigma^2\), giving the stated noncentral chi-square law. For \(I_n\), this parameter is zero exactly when \(\mu=0\). For \(C\), it is zero exactly when \(C\mu=0\), equivalently when \(\mu\in\operatorname{span}(\mathbf{1})\). \(\square\)

The covariance assumption matters: the argument uses spherical covariance so that orthogonal transformations preserve independence and equal coordinate variances. The projection ranks alone do not establish these distributions for an arbitrary covariance matrix.

Worked Example: Checking Centrality Under a Constant Mean

Suppose \(Y\sim N_3((4,4,4)^\mathsf{T},\sigma^2I_3)\). Determine the distributions of the uncorrected and corrected sums of squares after scaling by \(\sigma^2\).

For the uncorrected sum, the degrees of freedom are \(3\), and the noncentrality is \(\mu^\mathsf{T}\mu/\sigma^2=(16+16+16)/\sigma^2=48/\sigma^2\). Thus \(Y^\mathsf{T}Y/\sigma^2\sim\chi^2_3(48/\sigma^2)\).

For the corrected sum, \(C\mu=0\) because \(\mu\) is constant. Its degrees of freedom are \(3-1=2\) and its noncentrality is zero. Thus \(Y^\mathsf{T}CY/\sigma^2\sim\chi^2_2\), a central chi-square distribution. A nonzero common mean affects distance from zero but disappears when deviations are taken from the sample mean.

Common Mistakes and Practical Interpretation

  • Using “total sum of squares” without identifying the reference. State whether the quantity is measured from zero or from \(\bar y\).
  • Assuming the uncorrected sum is centered. \(y^\mathsf{T}y\) includes the constant component \(n\bar y^2\); it is not generally the corrected total.
  • Assuming any model projection decomposes the corrected total. Orthogonal projection always decomposes \(y^\mathsf{T}y\) into model and residual lengths, but a centered decomposition requires the model to contain the intercept.
  • Calling a corrected sum central just because the mean is constant. A constant mean makes the corrected quadratic form central under spherical normality; it does not make \(Y^\mathsf{T}Y\) central unless the mean is zero.

The practical question is therefore not merely which sum of squares is available, but which subspace and reference point the analysis treats as baseline. The uncorrected form is the squared length in the full observation space. The corrected form removes the constant-vector direction. An intercept puts that direction inside the model and permits the remaining model variation to be described among centered vectors.

Check Your Understanding

Use the projection interpretation to answer each question.

  1. For \(y=(1,3,2)^\mathsf{T}\), calculate the uncorrected and corrected total sums of squares, and identify the squared length of the constant component.
  2. What subspace does \(C=I_n-\mathbf{1}\mathbf{1}^\mathsf{T}/n\) project onto, and what is its rank?
  3. Why does a model space containing \(\mathbf{1}\) allow the centered part of the fitted vector to lie in \(M_0=M\cap\operatorname{span}(\mathbf{1})^\perp\)?
  4. Under \(Y\sim N_n(\mu,\sigma^2I_n)\), what condition on \(\mu\) makes the corrected sum of squares central?
  5. Why is the orthogonal fitted-and-residual decomposition of \(y^\mathsf{T}y\) available even when a model has no intercept, while a centered model decomposition need not be?
Clinical Biostats