Calculates the total sum of squares \(\left( \mathrm{TSS} \right)\) using $$ \mathrm{TSS} = \sum_{i = 1}^{n} \left( Y_i - \bar{Y} \right)^2 \\ = \sum_{i = 1}^{n} Y_{i}^{2} - n \bar{Y}^2 $$ In matrix form $$ \mathrm{TSS} = \sum_{i = 1}^{n} \left( \mathbf{y} - \mathbf{\bar{y}} \right)^2 $$ Equivalent computational matrix formula $$ \mathrm{TSS} = \mathbf{y}^{\prime} \mathbf{y} - n \mathbf{\bar{Y}}^{2}. $$ Note that $$ \mathrm{TSS} = \mathrm{ESS} + \mathrm{RSS} . $$
TSS(y)
y | Numeric vector of length |
---|
Returns the total sum of squares \(\left( \mathrm{TSS} \right)\).
Wikipedia: Residual Sum of Squares
Wikipedia: Explained Sum of Squares
Wikipedia: Total Sum of Squares
Wikipedia: Coefficient of Determination
Ivan Jacob Agaloos Pesigan
#> [1] 80309.82