Regression Anova output

How do I extract Sum of Squares 283.5 from Anova output? It is not a$SumSq[3]

data(mtcars)
df <- data.frame(mtcars)
formula <- mpg~disp + hp
model <- lm(formula, data=df)
anova <- aov(formula, data=df)
a <- summary(anova)
str(a)

List of 1
:Classes ‘anova’ and 'data.frame': 3 obs. of 5 variables: .. Df : num [1:3] 1 1 29
.. Sum Sq : num [1:3] 808.9 33.7 283.5 .. Mean Sq: num [1:3] 808.89 33.67 9.78
.. F value: num [1:3] 82.75 3.44 NA .. Pr(>F) : num [1:3] 5.41e-10 7.37e-02 NA

  • attr(*, "class")= chr [1:2] "summary.aov" "listof"

I do not see a way to get it except direct calculation.

sum(anova$residuals^2)
[1] 283.4934

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.