title: R - 2x2 mixed ANOVA with repeated measures simple effect analysis
body: <p>I would like to ask how to perform the <strong>simple main effect analysis in R</strong> correctly, in case of presence interaction effects between Group and Stage variables ?</p>
  
  <p>One of my friends do same analysis in SPSS (using Bonferroni correction) and I try to reproduce his result in R.</p>
  
  <p>I have data set of following structure:</p>
  
  <pre><code>ID Group Stage Y
  1   I     pre  0.123
  1   I     post 0.453
  2   II    pre  0.676
  2   II    post 0.867
  3   I     pre  0.324
  3   I     post 0.786
  4   II    pre  0.986
  4   II    post 0.112
  ... ... ... ...
  </code></pre>
  
  <p>This is <strong>2x2 mixed ANOVA schema</strong> (1 between subject variable 'Group', 1 within subject  variable 'Stage', which constitutes repated measure of y dependent variable).</p>
  
  <p>I analysed it using ezANOVA function:</p>
  
  <pre><code>ezANOVA(data = dat, dv = y, wid = ID, between = Group, within = Stage, detailed = TRUE, type = "III")
  </code></pre>
  
  <p>I found a significant interaction Stage*Group. So I have determine simple effects using Bonferroni correction. I tried to do that with many methods. For example, if I want to find significant interactions in group I, between levels of Stage variable, I tried to use:</p>
  
  <pre><code>dataControl &lt;- subset(dat, Group == "control" )
  
  ezANOVA(data = dataControl, dv = y, wid = ID, within = Stage, detailed = TRUE, type = "III" )  // method 1
  
  aov(data = dataControl, y ~ Stage + Error(ID/Stage))  // method 2
  
  t.test(y ~ Stage, paired=TRUE)  // method 3
  </code></pre>
  
  <p><strong>But every method gave me different p-value result. None of these p-values matched those calculated with SPSS.</strong> Interesingly main effects p-values and other calculation gave the same result in SPSS and R. So I conclude that I am using wrong method in simple main effect analysis.</p>
  
  <p>I would be very thankful I you could help me.</p>