2
$\begingroup$

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)
    
$\endgroup$
  • $\begingroup$ Could you give more details about the study design? Or a link to the paper? $\endgroup$ – Mark White May 19 '17 at 2:06
  • $\begingroup$ @MarkWhite, here is a link to the paper: link and link. $\endgroup$ – SArispe May 19 '17 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.