[R] ANOVA Table for Full Linear Model?

Jason R. Finley uniace at mac.com
Tue Feb 6 08:33:54 CET 2007


Hello,
I have spent a good deal of time searching for an answer to this but  
have come up empty-handed; I apologize if I missed something that is  
common knowledge.

I am trying to figure out how to get an ANOVA table that shows the  
sum of squares. degrees of freedom, etc, for the full model versus  
the error (aka residuals).

Here is an example of the kind of table I'd like to get:

Analysis of Variance
Source       DF          SS          MS         F        P
Regression    1      8654.7      8654.7    102.35    0.000
Error        75      6342.1        84.6
Total        76     14996.8

This kind of table is prevalent throughout my statistics textbook,  
and can apparently be easily obtained in other statistical software  
tools.  I'm not saying this as a gripe, but just as evidence that I'm  
not trying to do something obviously bizarre.


Here is an example of the only kind of ANOVA table for a single  
linear model that I've been able to get using R:

 > regression9 <- lm(y ~ x1 + x2 + x3, data=data9)
 > anova.lm(regression9)
Analysis of Variance Table

Response: y
           Df Sum Sq Mean Sq F value    Pr(>F)
x1         1 8275.4  8275.4 81.8026 2.059e-11 ***
x2         1  480.9   480.9  4.7539   0.03489 *
x3         1  364.2   364.2  3.5997   0.06468 .
Residuals 42 4248.8   101.2
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1


Is there a way to get an ANOVA table with the full linear regression  
model considered as a whole rather than broken down into each  
additional predictor variable?  In other words, is there a way to get  
the former kind of table?

Again, apologies if I'm missing something basic.
thanks very much,
~jason


PS - I am on Mac OSX 10.4.8 using R 2.4.1 GUI 1.18 (4038)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Jason R. Finley
Graduate Student, Department of Psychology
Cognitive Division
University of Illinois, Urbana-Champaign

uniace at mac.com
jrfinley at uiuc.edu
http://www.jasonfinley.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



More information about the R-help mailing list