[R] lm and anova

Sara Sjöstedt de Luna sara.de.luna at math.umu.se
Fri May 13 14:16:00 CEST 2011


Thanks a lot!

Best, 
Sara

-----Ursprungligt meddelande-----
Från: istazahn at gmail.com [mailto:istazahn at gmail.com] För Ista Zahn
Skickat: den 12 maj 2011 16:46
Till: Sara Sjöstedt de Luna
Kopia: r-help at r-project.org; Katie Andrle (katie.andrle at gmail.com) (katie.andrle at gmail.com)
Ämne: Re: [R] lm and anova

Hi Sara,
As the help page for anova.lm says,

"Specifying a single object gives a sequential analysis of variance table".

That most likely also the answer to your second question.

The anova function can be used to compare nested models, and this provides the flexibility to test arbitrary hypotheses, including all the ones given by different "types" of ANOVA tables. You may also find the Anova() function in the car package helpful.

Best,
Ista
On Thu, May 12, 2011 at 2:37 AM, Sara Sjöstedt de Luna <sara.de.luna at math.umu.se> wrote:
> Hi!
>
> We have run a linear regression model with 3 explanatory variables and get the output below.
> Does anyone know what type of test the anova model below does and why we get so different result in terms of significant variables by the two tables?
>
> Thanks!
>
> /Sara
>
>> summary(model)
> Call:
> lm(formula = log(HOBU) ~ Vole1 + Volelag + Year)
> Residuals:
>      Min        1Q    Median        3Q       Max
> -0.757284 -0.166681  0.009478  0.181304  0.692916
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept) 80.041737  12.018726   6.660 1.40e-07 ***
> Vole1        0.005521   0.041626   0.133   0.8953 Volelag      
> 0.033966   0.018392   1.847   0.0738 .
> Year        -0.035927   0.006027  -5.961 1.08e-06 ***
>
> anova(model)
> Analysis of Variance Table
> Response: log(HOBU)
>          Df Sum Sq Mean Sq F value    Pr(>F)
> Vole1      1 1.7877  1.7877 13.1772 0.0009486 *** Volelag    1 0.5817  
> 0.5817  4.2878 0.0462831 * Year       1 4.8205  4.8205 35.5323 
> 1.082e-06 *** Residuals 33 4.4769  0.1357
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



--
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology http://yourpsyche.org



More information about the R-help mailing list