Explained sum of squares: Difference between revisions

Content deleted Content added
cleaned up a really messy bit of typesetting
Rdsk2014 (talk | contribs)
m →‎Partitioning in the general ordinary least squares model: subscript implies square root which was wrong see https://en.wikipedia.org/wiki/Norm_(mathematics)#p-norm
Line 84:
Using <math> \hat y = X \hat \beta</math> in this, and simplifying to obtain <math>\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>y^T \bar y = \hat y^T \bar y</math>. The left side of this is <math>y_m</math> times the sum of the elements of ''y'', and the right side is <math>y_m</math> times the sum of the elements of <math>\hat y</math>, so the condition is that the sum of the elements of ''y'' equals the sum of the elements of <math>\hat y</math>, or equivalently that the sum of the prediction errors (residuals) <math>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>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>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>RSS = \|y - {\hat y}\|_2^2 </math>, <math> TSS = \|y - \bar y\|_2^2</math>, <math> ESS = \|{\hat y} - \bar y\|_2^2 </math>.
The proof can be simplified by noting that <math> y^T {\hat y} = {\hat y}^T {\hat y} </math>. The proof is as follows:
:<math> {\hat y}^T {\hat y} =
Line 90:
 
Thus,
:<math> TSS = \|y - \bar y\|_2^2 = \|y - {\hat y} + {\hat y} - \bar y\|_2^2 </math>
:<math> TSS = \|y - {\hat y}\|_2^2 + \|{\hat y} - \bar y\|_2^2 + 2 <y - {\hat y}, {\hat y} - {\bar y}> </math>
:<math> TSS = RSS + ESS + 2 y^T {\hat y} -2 {\hat y}^T {\hat y} - 2 y^T {\bar y} + 2 {\hat y}^T{\bar y} </math>
:<math> TSS = RSS + ESS - 2 y^T {\bar y} + 2 {\hat y}^T{\bar y} </math>