Solved – One-way repeated measures anova

anovanested datarrepeated measurestime series

I tried finding an answer to this question on this and other sites but to no avail – if I am missing something please excuse my inability to locate the answer!

Basically I have several dependent variables (dv) for two land management treatments (treat) measured quarterly (season). I know that I need to run a RM-ANOVA with season as a random effect, and so I am using the lme test in R. What I cant work out is whether I should be including season as a random variable like so:

lme <- lme(dv ~ treat, random = ~1|season, data=data)

or whether I should be nesting season within treatment like so:

lme <- lme(dv ~ treat, random = ~1|treat/season, data=data)

Many thanks for your assistance!

Best Answer

Major update, based on your comment.

The code should be something like when using lme from nlme:

lme.model <- lme(dv ~ season * treat, random = ~1|rep, data=data)

where rep is a factor assigning unique codes to each of your 10 independent study sites (i.e., 5 per treatment), season is a factor indicating measurment quarter, and treatment is the treatment factor.

However, this will not give you a real ANOVA but a mixed model with one random effect (rep) and two fixed effects (season and between).

To fit a real ANOVA (namely one with one between- and one within-subjects factor, a so called split-plot design) you could use package afex:

require(afex)
anova <- ez.glm("rep", "dv", data = data, within = "season", between = "treat")

You could run this on each dv separately.

To analyze all dvs together you would need some multivariate analysis of which I am no expert.


Response prior to your comment:

If treat is your unit of observation (of which having two seems to be quite low), then the following code would be correct:

lme <- lme(dv ~ season, random = ~1|treat, data=data)

However, as said, having a repeated measures ANOVA with only two units of observation is pretty uncommon and seems a bad idea. If this is really your design (observed two treatments over several seasons), you are probably better off with other analyses, such as single-case analysis, e.g., here.

Related Question