title: How to remake aov() to car package Anova() to get Mauchly's test for sphericity, Greenhouse-Geisser and eta-squared?
body: <p>I want to convert a code written for aov() to Anova() function in car-package. </p>
  
  <pre><code>anovadata3 &lt;- within(anovadata3, {
    subject &lt;- factor(subject)
    time &lt;- factor(time)
    gender &lt;- factor(gender)
    group &lt;- factor(group)
    groupgender &lt;- factor(groupgender)
  })
  
  anovadata3.aov &lt;- aov(values ~ time*group*gender + Error(subject),
                        data = anovadata3)
  summary(anovadata3.aov)
  </code></pre>
  
  <p>This code give the me the following output:</p>
  
  <pre><code>Error: subject
                Df Sum Sq Mean Sq F value  Pr(&gt;F)   
  group          1  32220   32220   8.632 0.00365 **
  gender         1     30      30   0.008 0.92819   
  group:gender   1     15      15   0.004 0.94952   
  Residuals    221 824913    3733                   
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  
  Error: Within
                     Df Sum Sq Mean Sq F value   Pr(&gt;F)    
  time                3  21160    7053   9.223 5.53e-06 ***
  time:group          3  18338    6113   7.993 3.06e-05 ***
  time:gender         3   1916     639   0.835  0.47486    
  time:group:gender   3  11679    3893   5.091  0.00172 ** 
  Residuals         663 507012     765                     
  ---
  Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  </code></pre>
  
  <p>However when i try using the Anova() function from car-package i do:</p>
  
  <pre><code>library(car)
  mlm &lt;- lm(values ~ time*group*gender, data = anovadata3)
  rfactor &lt;- factor(c("time", "gender","group","groupgender","subject"))
  anovadata3.aov &lt;- Anova(mlm, idata = dataframe(rfactor), idesign = ~ rfactor, type ="III")
  summary(anovadata3.aov)
  </code></pre>
  
  <p>Which gives me this output. </p>
  
  <pre><code>     Sum Sq                Df         F value              Pr(&gt;F)       
   Min.   :     58.3   Min.   :  1   Min.   :  0.03871   Min.   :0.00000  
   1st Qu.:   1324.9   1st Qu.:  1   1st Qu.:  0.54230   1st Qu.:0.04997  
   Median :  10281.5   Median :  3   Median :  1.57697   Median :0.21357  
   Mean   : 196286.3   Mean   :100   Mean   : 34.03103   Mean   :0.31053  
   3rd Qu.:  12290.4   3rd Qu.:  3   3rd Qu.:  2.61758   3rd Qu.:0.50989  
   Max.   :1331924.5   Max.   :884   Max.   :262.67095   Max.   :0.84408  
                                     NA's   :1           NA's   :1  
  </code></pre>
  
  <p>Does anyone know how i can remake the code that i use for aov() to fit the Anova(). I tried to follow the tutorial from:
  <a href="https://gribblelab.wordpress.com/2009/03/09/repeated-measures-anova-using-r/" rel="nofollow">https://gribblelab.wordpress.com/2009/03/09/repeated-measures-anova-using-r/</a></p>
  
  <p>to try to get the Anova() correct. But it doesn't give an output that looks similar. I also see from the webpage that it's suppose so give Mauchlys and Greenhouse, which i don't get. Also does anyone know how to get the eta-squared in the anova results? Or is it necessary to use seperate function to calculate the eta (etaSquared()).</p>
  
  <p>The data below was used for the test, and i'm trying to test if there is a significant difference in "values" between time, gender and group and interaction effects between the factors. </p>
  
  <pre><code>          values  testperiod subject gender group groupgender time
  1   118.82660110     Pretest       1      2     2   BSTfemale    1
  2    61.07615138     Pretest       2      2     2   BSTfemale    1
  3    57.51022740     Pretest       3      2     2   BSTfemale    1
  4    70.73637347     Pretest       4      2     2   BSTfemale    1
  5     9.86907880     Pretest       5      2     2   BSTfemale    1
  6    64.51579546     Pretest       6      2     2   BSTfemale    1
  7    63.25669342     Pretest       7      2     2   BSTfemale    1
  8   109.09354856     Pretest       8      2     2   BSTfemale    1
  9   140.69340502     Pretest       9      2     2   BSTfemale    1
  10   93.94269807     Pretest      10      2     2   BSTfemale    1
  11   43.76802256     Pretest      11      2     2   BSTfemale    1
  
  ...
  898  60.85271722 FU_12_month     223      1     2     BSTmale    4
  899  82.75598576 FU_12_month     224      1     2     BSTmale    4
  900 -32.38497309 FU_12_month     225      1     2     BSTmale    4
  </code></pre>