Hi,
I am having trouble using the lme function to perform a nested ANOVA
with a random nested factor.
My design is as follows:
Location (n=6) (Random)
Site nested within each Location (n=12) (2 Sites nested within each
Location) (Random)
Dependent variable: sp (species abundance)
By using the aov function I can generate a nested ANOVA, however this
assumes that my nested factor is fixed.
> summary(aov(sp~Location/Site, data=mavric))
Df Sum Sq Mean Sq F value Pr(>F)
Location 4 112366 28092 1.2742 0.2962
Location:Transect 5 121690 24338 1.1039 0.3736
Residuals 40 881875 22047
I have tried the following lme function to specify that Site is random:
> lme1 <- lme(sp~Location, random=~1|Site, data=mavric)
> lme2 <- lme(sp~Location, random=~1|Location/Site, data=mavric)
> anova(lme1)
numDF denDF F-value p-value
(Intercept) 1 40 3.418077 0.0719
Location 4 5 1.152505 0.4294
This gives me the correct F-value for Location from
MSLocation/MSLocation:Transect, but the p-value doesn't seem to be
correct (by my calculations in Microsoft Excel it should be 0.345)
> anova(lme2)
Warning in pf(q, df1, df2, lower.tail, log.p) :
NaNs produced
Warning: NAs introduced by coercion
numDF denDF F-value p-value
(Intercept) 1 40 0.459966 0.5015
Location 4 0 0.155091 NaN
? I don't know what this output means
> anova(lme1,lme2)
Model df AIC BIC logLik Test L.Ratio p-value
lme1 1 7 603.7534 616.4000 -294.8767
lme2 2 8 605.7534 620.2067 -294.8767 1 vs 2 1.815674e-05 0.9966
? I also don't know what this output means.
Can anyone tell me if there is a way to use the lme() function in order
to obtain the same output as the aov() function (above), but so it
correctly calculates the MS, F and p values for my main Location factor?
Thanks,
Prue
This e-mail is solely for the named addressee and may be confidential.
You should only read, disclose, transmit, copy, distribute, act in reliance
on or commercialise the contents if you are authorised to do so. If you
are not the intended recipient of this e-mail, please notify
[EMAIL PROTECTED] by e-mail immediately, or notify the sender
and then destroy any copy of this message. Views expressed in this e-mail
are those of the individual sender, except where specifically stated to be
those of an officer of Museum Victoria. Museum Victoria does not represent,
warrant or guarantee that the integrity of this communication has been
maintained nor that it is free from errors, virus or interference.
Museum Victoria
+61 3 8341 7777
11 Nicholson St
Carlton
Victoria
www.museum.vic.gov.au
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html