Hi Stephen, Slip of the dactylus: lm() does not, of course, take a fixed=arg. So you need
To recap: mod.rand <- lme(fixed=y ~ x, random=~x|Site, data=...) mod,fix <- lm(y ~ x, data=...) ## or ##mod,fix <- lm(formula=y ~ x, data=...) Bye. Mark Difford wrote: > > Hi Stephen, > >>> Also i have read in Quinn and Keough 2002, design and analysis of >>> experiments for >>> biologists, that a variance component analysis should only be conducted >>> after a rejection >>> of the null hypothesis of no variance at that level. > > Once again the caveat: there are experts on this list who really know > about this stuff, and I am not one of them. Your general strategy would > be to set up two models with the same fixed effects, one of which doesn't > have random effects. You then test the two models using > anova(mod.withRandom, modWithoutRandom). > > I haven't tried this using lmer/2(), but with lme() you do this by fitting > your fixed+random effects model using lme() and your fixed-only effects > model using lm(). If you are using weights to model heteroskedasticity, > then it's better to use gls(), as this will accept the same weights > argument as the call to lme(). > > Then you simply do anova(lme.model, lm/gls.model). This tells you about > the significance of your random effects, i.e. whether you need a > random-effects component. > > To recap: > mod.rand <- lme(fixed=y ~ x, random=~x|Site, data=...) > mod,fix <- lm(fixed=y ~ x, data=...) > > anova(mod.rand, mod.fix) > > HTH, Mark. > > > Stephen Cole-2 wrote: >> >> First of all thank you for the responses. I appreciate the >> suggestions i have received thus far. >> >> Just to reiterate >> >> I am trying to analyze a data set that has been collected from a >> hierarchical sampling design. The model should be a mixed model >> nested ANOVA. The purpose of my study is to analyze the variability >> at each spatial scale in my design (random factors, variance >> components), and say something about the variability between regions >> (fixed factor, contrast of means). The data is as follows; >> >> region (fixed) >> Location (random) >> Site(random) >> >> site nested in location nested in region. >> >> Also i have read in Quinn and Keough 2002, design and analysis of >> experiments for biologists, that a variance component analysis should >> only be conducted after a rejection of the null hypothesis of no >> variance at that level. >> >> I have tried to implement >> mod1<-lmer(density ~ 1 + (1|site) + (1|location) + (1|region)) >> >> However, as i understand it, this treats all my factors as random. >> Plus I do not know how to extract SS or MS from this model. >> >> anova(mod1) gives me >> Analysis of Variance Table >> Df Sum Sq Mean Sq >> >> and summary(mod1) gives me >> Linear mixed-effects model fit by REML >> Formula: density ~ 1 + (1 | site) + (1 | location) + (1 | region) >> AIC BIC logLik MLdeviance REMLdeviance >> 15658 15678 -7825 15662 15650 >> Random effects: >> Groups Name Variance Std.Dev. >> site (Intercept) 22191 148.97 >> location (Intercept) 33544 183.15 >> region (Intercept) 41412 203.50 >> Residual 696189 834.38 >> number of obs: 960, groups: site, 4; location, 4; region, 3 >> >> Fixed effects: >> Estimate Std. Error t value >> (Intercept) 261.3 168.7 1.549 >> >> from what i understand the variance in the penultimate column are my >> variance components. But how do i conduct my significance test? >> >> I have also tried >> mod1<-lmer(density ~ region + (1|site) + (1|location)) >> >> Which i think is the correct mixed model for my design. However once >> again i do not know how to evaluate significance for the random >> factors. >> >> Thank-you again for any additional advice i receive >> >> Stephen Cole >> >> ______________________________________________ >> R-help@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. >> >> > > -- View this message in context: http://www.nabble.com/mixed-model-nested-ANOVA-%28part-two%29-tp15665478p15669608.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.