[R-sig-eco] aov vs. glm

Lara R. Appleby 04 Lara.R.Appleby.04 at Alum.Dartmouth.ORG
Fri Nov 11 02:23:32 CET 2011


Below are the results obtained from doing a two way anova using glm (Method 1)  
and aov (Method 2).

##Method 1
>  summary(glm(clutchsize~treatment*species))

Call:
glm(formula = clutchsize ~ treatment * species)

Deviance Residuals:
     Min       1Q   Median       3Q      Max
-4.6223  -1.3917   0.0171   1.3777   6.6974

Coefficients:
                   Estimate Std. Error t value Pr(>|t|)
(Intercept)         7.7095     1.2679   6.080 8.23e-09 ***
treatment          -0.2480     0.5845  -0.424 0.671891
species            -3.0463     0.8837  -3.447 0.000721 ***
treatment:species   0.5677     0.4069   1.395 0.164874
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for gaussian family taken to be 4.166879)

     Null deviance: 854.72  on 166  degrees of freedom
Residual deviance: 679.20  on 163  degrees of freedom
AIC: 718.21

Number of Fisher Scoring iterations: 2

##Method 2
>  summary(aov(clutchsize~treatment*species))
                    Df Sum Sq Mean Sq F value   Pr(>F)
treatment           1  29.26  29.264  7.0230  0.00884 **
species             1 138.14 138.143 33.1526 4.13e-08 ***
treatment:species   1   8.11   8.110  1.9464  0.16487
Residuals         163 679.20   4.167
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

--- Chris Howden <chris at trickysolutions.com.au> wrote:
It would help if u posted the results so we know how different.

But have a look at the defaults for a call to glm. Are they the same as for lm?

There are some differences in the output for glm and lm objects when
using summary.

Chris Howden
Founding Partner
Tricky Solutions
Tricky Solutions 4 Tricky Problems
Evidence Based Strategic Development, IP Commercialisation and
Innovation, Data Analysis, Modelling and Training

(mobile) 0410 689 945
(fax / office)
chris at trickysolutions.com.au

Disclaimer: The information in this email and any attachments to it are
confidential and may contain legally privileged information. If you are not
the named or intended recipient, please delete this communication and
contact us immediately. Please note you are not authorised to copy,
use or disclose this communication or any attachments without our
consent. Although this email has been checked by anti-virus software,
there is a risk that email messages may be corrupted or infected by
viruses or other
interferences. No responsibility is accepted for such interference. Unless
expressly stated, the views of the writer are not those of the
company. Tricky Solutions always does our best to provide accurate
forecasts and analyses based on the data supplied, however it is
possible that some important predictors were not included in the data
sent to us. Information provided by us should not be solely relied
upon when making decisions and clients should use their own judgement.

On 11/11/2011, at 10:25, "Lara R. Appleby 04"
<Lara.R.Appleby.04 at alum.dartmouth.org> wrote:

>  I'm trying to basically do a two way ANOVA on the dependent variable (clutchsize)  
>with the two independent variables (treatment and species). It seems that there  
>are three ways I can say this in R:
>
>  1. glm(clutchsize~treatment*species)
>  2. aov(clutchsize~treatment*species)
>  3. anova(lm(clutchsize~treatment*species)
>
>  Methods 2 and 3 yield equivalent results, but Method 1 is completely different!
>
>  Any idea why?
>
>  Lara Appleby
>
>  _______________________________________________
>  R-sig-ecology mailing list
>  R-sig-ecology at r-project.org
>  https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
--- end of quote ---



More information about the R-sig-ecology mailing list