0
votes

I am trying to run 2x2 mixed ANOVA with unequal sample size using R. The data was collected from 30 individuals with two different conditions (i.e., 2 levels of within factor), and they were allocated by k-means clustering analysis (i.e., # of group 1 = 11, # of group 2 = 19). Here is a sample of my code and the output:

summary(aov(JH ~ Box+Group+Box:Group+Error(P/Box), data = d3))

Error: P
          Df Sum Sq Mean Sq F value Pr(>F)
Group      1  0.027 0.02715    1.56   0.22
Box:Group  1  0.001 0.00078    0.04   0.83
Residuals 27  0.470 0.01741               

Error: P:Box
          Df   Sum Sq  Mean Sq F value Pr(>F)
Box        1 0.000000 1.00e-07    0.00   0.97
Group      1 0.000022 2.17e-05    0.24   0.63
Box:Group  1 0.000032 3.24e-05    0.35   0.56
Residuals 27 0.002488 9.21e-05  

Unlike the output when I ran 2x2 mixed ANOVA with equal sample sizes using another dataset (the output attached below), I had another interaction effect under Error: P.

summary(aov(HipLoadingK ~ Box*Sex+Error(P/Box), data = TW))

Error: P
          Df  Sum Sq  Mean Sq F value  Pr(>F)   
Sex        1 0.02578 0.025779   8.038 0.00841 **
Residuals 28 0.08980 0.003207                   
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: P:Box
          Df   Sum Sq  Mean Sq F value Pr(>F)  
Box        1 0.003454 0.003454   4.271 0.0481 *
Box:Sex    1 0.000066 0.000066   0.082 0.7765  
Residuals 28 0.022645 0.000809

Is this result fine as long as I interpret appropriate results for each between/within main effects and interaction effect? Or should I edit my code to get the correct outputs? If so, please let me know what should be added or edited in my code.

1
two parts to your question, the interpretation part about whether it's ok, that belongs to cross-validated. the coding part, your output looks really weird I don't understand you are trying to do here without a reproducible exampleStupidWolf
@StupidWolf Thank you for your considering my question. I just found out my allocation code caused the error. After fixing the code, it worked!Youngmin Chun

1 Answers

0
votes

When I change the dataset from a short format to a long format, I accidentally put the different order of group name for each participant. For instance, P01 was group A in X condition, but his or her group was B in Y condition. After I fixed the code, it worked well.