# Specifying a mixed model with a repeated measurements factor and a random interaction factor in lmer vs. lme

Please help me understand how to write R code for a common experimental design in my field. The exact statistical model is in the Stats Analysis paragraph below:.

Statistical Analyses

We used repeated measures analysis of variance (ANOVA) in SAS v. 9.2 (SAS Institute, Inc., Cary, NC, USA) with the mixed models procedure to determine the effects of intermediate-termrest from grazing on plant community characteristics. Year was the repeated variable, treatment was considered a fixed variable, and block and block by treatment interactions were treated as random variables in analyses.

1. Since this is a linear mixed-effect model, would I use lmer (lme4 library) or lme (nlme library)?

2. Would this be the way to write it using lmer?

fm1 = lmer(PG ~ Trt + Year + (1 | Block) + (1|Block:Trt), RK_data,
REML = FALSE)


Does the (1|Block:Trt) properly represent the block by treatment interactions as a random variable?

3. What would be the proper way to write the model using lme? How would I write the block by treatment interaction as a random variable using lme? Below is what I started:

fm1 = lme(PG ~ Trt+Year, random= ~ 1|Block, data=RK_data)

• Could you give more details about the study design? Or a link to the paper? – Mark White May 19 '17 at 2:06
• @MarkWhite, here is a link to the paper: link and link. – SArispe May 19 '17 at 20:34