Re: [R] Mixed model Nested ANOVA

From: Mark Difford <>
Date: Fri, 22 Feb 2008 13:53:31 -0800 (PST)

Hi Stephen,

Hopefully you will get an answer from one of the experts on mixed models who subscribe to this list. However, you should know that both lme() and lmer() currently have anova() methods. The first will give you p-values (but no SS), and the second will give you SS (but no p-values). You can, however, get the latter using functions in the languageR package. This also has an aovlmer.fnc() that uses MCMC to get p-values.

>From what you have said about your data, and about what you want from them,
you clearly should be using either lme() or lmer(). Further, objects from both functions work with glht() from the multcomp package, so you also have access to a full range of post-hoc tests.

HTH, Mark.

Stephen Cole-2 wrote:
> hello R help
> 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.
> I would like to run this as an ANOVA and then compute variance components.
> My question is when i use the aov command; mod1 <- aov(density ~
> region/location/site)
> is there any way to tell R which factor is random and fixed.
> I know i can specify fixed and random factors using lme or lmer but these
> methods do not allow me to extract an anova table (or do they?)
> I know that the data can be analyzed using a nested ANOVA because i have
> based my design on several papers in the marine biological literature
> (MEPS). Thank-you for any advice in advance.
> Stephen Cole
> [[alternative HTML version deleted]]
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 22 Feb 2008 - 22:02:42 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 22 Feb 2008 - 23:30:16 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive