[R] Accessing specific values of linear regression model

Kelly Vincent kpvincent at hotmail.com
Thu Mar 23 19:22:05 CET 2006


I am just starting to learn R, and I'm struggling with a lot of the basic 
stuff. The online documentation is generally good, but I have been unable to 
find the answer for my problem this time.

I am running linear regression on a particular set of data and plotting it. 
I've got the regression line plotted and everything is fine so far, except 
for one thing: I want to display the SSE from the regression and I don't 
know how to access it. In my script I have:
model <- lm(y~x)
and I was able to get the r^2 value that I wanted with:
summary(model)$r.squared
But I don't know how to get the SSE. When I print the summary(aov(model)) I 
get the following:
            Df  Sum Sq Mean Sq F value    Pr(>F)
x            1 1793928 1793928  67.463 3.447e-11 ***
Residuals   56 1489118   26591
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

So it's there (I can see it!) but how do I get to it? Any help would be much 
appreciated.

Thanks,
Kelly




More information about the R-help mailing list