2
$\begingroup$

Can anyone explain the theory (or the formula) about computing Sum Sq (bold highligh below) related to regression items? The Wikipedia link gives an introduction on how to calculate the total, model, and regression sum of squares. Is it similar to the Sum Sq computation? Is the regression sum of squares equal to (0.000437+ 0.002545+ 0.060984+ 0.062330+ 0.060480)?

TraingData <- data.frame(x1 = c(3.532,2.868,2.868,3.532,2.868,2.536,3.864),
                         x2 = c(1.992,1.992,1.328,1.328,1.328,1.66,1.66),
                         y  = c(9.040330254,8.900894412,8.701929163,9.057944749,
                                8.701929163,8.74317832,9.10859913)
                         )
lm.sol <- lm(y~1+x1+x2+I(x1^2)+I(x2^2)+I(x1*x2), data=TraingData)
anova(lm.sol)

Analysis of Variance Table

Response: y
            Df   **Sum Sq**     Mean       Sq F    value Pr(>F)
x1          1   0.000437  0.000437    0.1055    0.8001
x2          1   0.002545  0.002545    0.6141    0.5768
I(x1^2)     1   0.060984  0.060984   14.7162    0.1623
I(x2^2)     1   0.062330  0.062330   15.0409    0.1607
I(x1 * x2)  1   0.060480  0.060480   14.5945    0.1630
Residuals   1   0.004144  0.004144  
$\endgroup$
  • $\begingroup$ I left out I(x1*x2). Then, apparently, the design matrix does not have full column rank. That is, there is some linear combination of the columns $x_1$, $x_2$, $x_1^2$ and $x_2^2$ that results in the intercept column $I=(1,1,1,1,1,1,1)$. For that reason, the coefficient of the last regressor you add to the model cannot be estimated. The rank is 4 while it should be 5 (i.e. number of regressors in the model). Interesting situation, though. Adding also regressor $x_1\cdot x_2$ yields a design matrix of rank 5 instead of 6, so also deficient. $\endgroup$ – StijnDeVuyst Jun 1 '19 at 19:39
  • $\begingroup$ ... which is an explanation for why I got the same result as Gottfried Helms, not the one shown by the OP. $\endgroup$ – StijnDeVuyst Jun 1 '19 at 19:56
1
$\begingroup$

I don't know what's going on there. I've got with that R-commands the following result:

Response: y
            Df   Sum Sq  Mean Sq  F value   Pr(>F) 
x1          1 0.156369 0.156369 101.7309 0.009687 **
x2          1 0.016152 0.016152  10.5079 0.083430 . 
I(x1^2)     1 0.000223 0.000223   0.1450 0.739982   
I(x1 * x2)  1 0.015101 0.015101   9.8244 0.088486 . 
Residuals   2 0.003074 0.001537                     

And this can easily be reproduced using the cholesky-decomposition of the Ko-/Self-product matrix of the data, when a column of constant data is prepended.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.