Explained sum of squares

From HandWiki
Short description: Statistical quantity


In statistics, the explained sum of squares (ESS), alternatively known as the model sum of squares or sum of squares due to regression (SSR – not to be confused with the residual sum of squares (RSS) or sum of squares of errors), is a quantity used in describing how well a model, often a regression model, represents the data being modelled. In particular, the explained sum of squares measures how much variation there is in the modelled values and this is compared to the total sum of squares (TSS), which measures how much variation there is in the observed data, and to the residual sum of squares, which measures the variation in the error between the observed data and modelled values.

Definition

The explained sum of squares (ESS) is the sum of the squares of the deviations of the predicted values from the mean value of a response variable, in a standard regression model — for example, yi = a + b1x1i + b2x2i + ... + εi, where yi is the i th observation of the response variable, xji is the i th observation of the j th explanatory variable, a and bj are coefficients, i indexes the observations from 1 to n, and εi is the i th value of the error term. In general, the greater the ESS, the better the estimated model performs.

If [math]\displaystyle{ \hat{a} }[/math] and [math]\displaystyle{ \hat{b}_i }[/math] are the estimated coefficients, then

[math]\displaystyle{ \hat{y}_i=\hat{a}+\hat{b}_1 x_{1i} + \hat{b}_2 x_{2i} + \cdots \, }[/math]

is the i th predicted value of the response variable. The ESS is then:

[math]\displaystyle{ \text{ESS} = \sum_{i=1}^n \left(\hat{y}_i - \bar{y}\right)^2. }[/math]
where [math]\displaystyle{ \hat{y}_i }[/math]the value estimated by the regression line .[1]

In some cases (see below): total sum of squares (TSS) = explained sum of squares (ESS) + residual sum of squares (RSS).

Partitioning in simple linear regression

The following equality, stating that the total sum of squares (TSS) equals the residual sum of squares (=SSE : the sum of squared errors of prediction) plus the explained sum of squares (SSR :the sum of squares due to regression or explained sum of squares), is generally true in simple linear regression:

[math]\displaystyle{ \sum_{i=1}^n \left(y_i - \bar{y}\right)^2 = \sum_{i=1}^n \left(y_i - \hat{y}_i\right)^2 + \sum_{i=1}^n \left(\hat{y}_i - \bar{y}\right)^2. }[/math]

Simple derivation

[math]\displaystyle{ \begin{align} (y_i - \bar{y}) = (y_{i}-\hat{y}_i)+(\hat{y}_i - \bar{y}). \end{align} }[/math]

Square both sides and sum over all i:

[math]\displaystyle{ \sum_{i=1}^n (y_i-\bar{y})^2=\sum_{i=1}^n (y_i - \hat{y}_i)^2+\sum_{i=1}^n (\hat{y}_i - \bar{y})^2 + \sum_{i=1}^n 2(\hat{y}_i-\bar{y})(y_i - \hat{y}_i). }[/math]

Here is how the last term above is zero from simple linear regression[2]

[math]\displaystyle{ \hat{y_i} = \hat{a} + \hat{b}x_i }[/math]
[math]\displaystyle{ \bar{y} = \hat{a} + \hat{b}\bar{x} }[/math]
[math]\displaystyle{ \hat{b} = \frac{\sum_{i=1}^n (x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=1}^n (x_i-\bar{x})^2} }[/math]

So,

[math]\displaystyle{ \hat{y_i} - \bar{y} = \hat{b}(x_i - \bar{x}) }[/math]
[math]\displaystyle{ y_i - \hat{y}_i = (y_i - \bar{y}) - (\hat{y}_i - \bar{y}) = (y_i - \bar{y}) - \hat{b}(x_i - \bar{x}) }[/math]

Therefore,

[math]\displaystyle{ \begin{align} & \sum_{i=1}^n 2(\hat{y}_i-\bar{y})(y_i-\hat{y}_i) = 2\hat{b}\sum_{i=1}^n (x_i-\bar{x})(y_i-\hat{y}_i) \\[4pt] = {} & 2\hat{b}\sum_{i=1}^n (x_i-\bar{x})((y_i - \bar{y}) - \hat{b}(x_i - \bar{x})) \\[4pt] = {} & 2\hat{b}\left(\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})-\sum_{i=1}^n(x_i-\bar{x})^2\frac{\sum_{j=1}^n (x_j-\bar{x})(y_j-\bar{y})}{\sum_{j=1}^n (x_j-\bar{x})^2}\right) \\[4pt] = {} & 2\hat{b} (0) = 0 \end{align} }[/math]

Partitioning in the general ordinary least squares model

The general regression model with n observations and k explanators, the first of which is a constant unit vector whose coefficient is the regression intercept, is

[math]\displaystyle{ y = X \beta + e }[/math]

where y is an n × 1 vector of dependent variable observations, each column of the n × k matrix X is a vector of observations on one of the k explanators, [math]\displaystyle{ \beta }[/math] is a k × 1 vector of true coefficients, and e is an n × 1 vector of the true underlying errors. The ordinary least squares estimator for [math]\displaystyle{ \beta }[/math] is

[math]\displaystyle{ \hat \beta = (X^T X)^{-1}X^T y. }[/math]

The residual vector [math]\displaystyle{ \hat e }[/math] is [math]\displaystyle{ y - X \hat \beta = y - X (X^T X)^{-1}X^T y }[/math], so the residual sum of squares [math]\displaystyle{ \hat e ^T \hat e }[/math] is, after simplification,

[math]\displaystyle{ RSS = y^T y - y^T X(X^T X)^{-1} X^T y. }[/math]

Denote as [math]\displaystyle{ \bar y }[/math] the constant vector all of whose elements are the sample mean [math]\displaystyle{ y_m }[/math] of the dependent variable values in the vector y. Then the total sum of squares is

[math]\displaystyle{ TSS = (y - \bar y)^T(y - \bar y) = y^T y - 2y^T \bar y + \bar y ^T \bar y. }[/math]

The explained sum of squares, defined as the sum of squared deviations of the predicted values from the observed mean of y, is

[math]\displaystyle{ ESS = (\hat y - \bar y)^T(\hat y - \bar y) = \hat y^T \hat y - 2\hat y^T \bar y + \bar y ^T \bar y. }[/math]

Using [math]\displaystyle{ \hat y = X \hat \beta }[/math] in this, and simplifying to obtain [math]\displaystyle{ \hat y^T \hat y = y^TX(X^T X)^{-1}X^Ty }[/math], gives the result that TSS = ESS + RSS if and only if [math]\displaystyle{ y^T \bar y = \hat y^T \bar y }[/math]. The left side of this is [math]\displaystyle{ y_m }[/math] times the sum of the elements of y, and the right side is [math]\displaystyle{ y_m }[/math] times the sum of the elements of [math]\displaystyle{ \hat y }[/math], so the condition is that the sum of the elements of y equals the sum of the elements of [math]\displaystyle{ \hat y }[/math], or equivalently that the sum of the prediction errors (residuals) [math]\displaystyle{ y_i - \hat y_i }[/math] is zero. This can be seen to be true by noting the well-known OLS property that the k × 1 vector [math]\displaystyle{ X^T \hat e = X^T [I - X(X^T X)^{-1}X^T]y= 0 }[/math]: since the first column of X is a vector of ones, the first element of this vector [math]\displaystyle{ X^T \hat e }[/math] is the sum of the residuals and is equal to zero. This proves that the condition holds for the result that TSS = ESS + RSS.

In linear algebra terms, we have [math]\displaystyle{ RSS = \|y - {\hat y}\|^2 }[/math], [math]\displaystyle{ TSS = \|y - \bar y\|^2 }[/math], [math]\displaystyle{ ESS = \|{\hat y} - \bar y\|^2 }[/math]. The proof can be simplified by noting that [math]\displaystyle{ {\hat y}^T {\hat y} = {\hat y}^T y }[/math]. The proof is as follows:

[math]\displaystyle{ {\hat y}^T {\hat y} = y^T X (X^T X)^{-1} X^T X (X^T X)^{-1} X^T y = y^T X (X^T X)^{-1} X^T y = {\hat y}^T y, }[/math]

Thus,

[math]\displaystyle{ \begin{align} TSS & = \|y - \bar y\|^2 = \|y - {\hat y} + {\hat y} - \bar y\|^2 \\ & = \|y - {\hat y}\|^2 + \|{\hat y} - \bar y\|^2 + 2 \langle y - {\hat y}, {\hat y} - {\bar y}\rangle \\ & = RSS + ESS + 2 y^T {\hat y} -2 {\hat y}^T {\hat y} - 2 y^T {\bar y} + 2 {\hat y}^T{\bar y} \\ & = RSS + ESS - 2 y^T {\bar y} + 2 {\hat y}^T{\bar y} \end{align} }[/math]

which again gives the result that TSS = ESS + RSS, since [math]\displaystyle{ (y-\hat y)^T \bar y = 0 }[/math].

See also

Notes

  1. "Sum of Squares - Definition, Formulas, Regression Analysis" (in en-US). https://corporatefinanceinstitute.com/resources/knowledge/other/sum-of-squares/. 
  2. Mendenhall, William (2009). Introduction to Probability and Statistics (13th ed.). Belmont, CA: Brooks/Cole. p. 507. ISBN 9780495389538. 

References

  • S. E. Maxwell and H. D. Delaney (1990), "Designing experiments and analyzing data: A model comparison perspective". Wadsworth. pp. 289–290.
  • G. A. Milliken and D. E. Johnson (1984), "Analysis of messy data", Vol. I: Designed experiments. Van Nostrand Reinhold. pp. 146–151.
  • B. G. Tabachnick and L. S. Fidell (2007), "Experimental design using ANOVA". Duxbury. p. 220.
  • B. G. Tabachnick and L. S. Fidell (2007), "Using multivariate statistics", 5th ed. Pearson Education. pp. 217–218.