Re: [R] Nested ANOVA with covariate using Type III sums of squares

From: Joris Meys <jorismeys_at_gmail.com>
Date: Fri, 04 Jun 2010 01:25:20 +0200

I see where my confusion comes from. I counted 4 levels of Phyto, but you have 8, being 4 in every level of Diversity. There's your aliasing.

> table(Diversity,Phyto)

         Phyto
Diversity M1 M2 M3 M4 P1 P2 P3 P4
        H  0  0  0  0  6  6  6  6
        L  6  6  6  6  0  0  0  0

There's no need to code them differently for every level of Diversity. If you don't, all is fine :

> Phyto <- gsub("M","P",as.character(Phyto))
> Phyto <- as.factor(Phyto)
>
> test <- lm(C.Mean~  Mean.richness + Diversity + Zoop + Diversity/Phyto +
+ Zoop*Diversity/Phyto)
>
> Anova(test,type="III")

Anova Table (Type III tests)

Response: C.Mean

                        Sum Sq Df F value    Pr(>F)
(Intercept)           23935609  1 10.0121 0.0034729 **
Mean.richness         49790385  1 20.8269 7.471e-05 ***
Diversity             35807205  1 14.9779 0.0005234 ***
Zoop                  10794614  1  4.5153 0.0416688 *
Diversity:Phyto      118553464  6  8.2650 2.184e-05 ***
Diversity:Zoop          261789  1  0.1095 0.7429356
Diversity:Zoop:Phyto  61710162  6  4.3021 0.0028790 ** Residuals             74110938 31
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

>
You can check with summary(test) that the model is fitted correctly. On Fri, Jun 4, 2010 at 12:48 AM, Anita Narwani <anitanarwani_at_gmail.com> wrote:
>
> You have everything right except that there are only 2 zooplankton species (C & D, which stand for Ceriodaphnia and Daphnia).
>
______________________________________________ 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.
Received on Thu 03 Jun 2010 - 23:29:37 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 04 Jun 2010 - 00:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive