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:.
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.
Since this is a linear mixed-effect model, would I use
Would this be the way to write it using
fm1 = lmer(PG ~ Trt + Year + (1 | Block) + (1|Block:Trt), RK_data, REML = FALSE)
(1|Block:Trt)properly represent the block by treatment interactions as a random variable?
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)