Solved – Nested/SplitModel – RepeatedMeasures/MixedModel ANOVA: levels of nesting & scripting in R

anovanested datarrepeated measuressplit-plot

My data set has the following variables:

  • Treatment (4 types- fixed)
  • Location (8 locations- fixed)
  • Position in Location (3 positions per location- fixed)
  • Samples are taken in each position (3 samples per position-random)
    • Time (two sampling times – fixed)
    • Mineralisation rate (as result of analysis of samples taken)

Two locations are used to test each treatment (ie 4 treatments, 2 locations per treatment, 8 locations total).

I want to do a split-plot (/nested?) repeated measures (/mixed model?) ANOVA in R using the above variables.

Q.1. Does this sound suitable?

My goal is to see if there is an affect of
1) position,
2) treatment,
3) time and
4) interaction of all (ie pos*treat*, pos*time, treat*time, pos*treat*time)
on mineralization rates.

Q 2. Is location nested in treatment? Is sample nested in position?

Q 3. What are the between- and within- factors?

Q 4. What is the subject/plot?
– Is it the location or position or sample or rate?

Q 5. How can I put time as repeated measures in my R formula?

Q 6. Would you use aov, lme, or ezANOVA?

Q 7. How do I code the seperate independent variables, and their interactions into a proper R formula?

I have literally been trying to figure this out for days and I cannot seem to find an answer that makes sense…

Best Answer

Tricky problem! Is location fixed or random? Is position fixed or random? I assume that sample is random.

  • Since treatment is assigned to location, location is the sampling unit. Basically, the comparison between treatments is done at that level. $n=8$.
  • The measurement unit is the observation you take on your "samples" at a given time.
  • Location is not nested in treatment. The treatment is applied to the location.
  • Position is nested inside location.
  • Sample is nested inside position.
  • Time is nested inside Sample.
  • Time is crossed with treatment.

You have 3 levels of nesting (time within sample, sample within position, position within location).

If location, position and sample are random, I think the R formula will look like this:

 Y ~ Treatment * Time +(1|location|position|sample)

You have 1 row in your data frame for each sample observation at each time - with appropriate codings for all of your design characteristics.

Would it work to combine the repeated measures into a score such as their average or their difference? That could make the model easier to interpret.

Related Question