title: Repeated measures ANOVA and link to mixed-effect models in R
body: <p>I have a problem when performing a two-way rm ANOVA in R on the following data (link : <a href="https://drive.google.com/open?id=1nIlFfijUm4Ib6TJoHUUNeEJnZnnNzO29" rel="nofollow noreferrer">https://drive.google.com/open?id=1nIlFfijUm4Ib6TJoHUUNeEJnZnnNzO29</a>):</p>
  
  <p><a href="https://i.stack.imgur.com/PW1Ya.png" rel="nofollow noreferrer">subjectnbr is the id of the subject and blockType and linesTTL are the independent variables. RT2 is the dependent variable</a></p>
  
  <p>I first performed the rm ANOVA through using ezANOVA with the following code: </p>
  
  <pre><code>ANOVA_RTS &lt;- ezANOVA(
      data=castRTs
      , dv=RT2
      , wid=subjectnbr
      , within = .(blockType,linesTTL)
      , type = 2
      , detailed = TRUE
      , return_aov = FALSE
  )
  ANOVA_RTS
  </code></pre>
  
  <p>The result is correct (I double-checked using statistica). </p>
  
  <p>However, when I perform the rm ANOVA using the lme function, I do not get the same answer and I have no clue why.</p>
  
  <p>There is my code: </p>
  
  <pre><code>lmeRTs &lt;- lme(
        RT2 ~ blockType*linesTTL, 
        random = ~1|subjectnbr/blockType/linesTTL, 
        data=castRTs)
  
  anova(lmeRTs)  
  </code></pre>
  
  <p>Here are <a href="https://i.stack.imgur.com/GfH2J.png" rel="nofollow noreferrer">the outputs of both ezANOVA and lme</a>.</p>
  
  <p>I hope I have been clear enough and have given you all the information needed. </p>
  
  <p>I'm looking forward for your help as I am trying to figure it out for at least 4 hours! </p>
  
  <p>Thanks in advance.</p>