2
$\begingroup$

I have an experiment where several subjects (subjects $= S_1,S_2,...,S_m $) were asked to perform a set of tasks (tasks $= T_1, T_2, T_3,...,T_n$) using both their left ($L$) and right ($R$) arms. Each task for each arm was repeated $r$ times. The response is measured in a variable called 'measure'. Unfortunately, there were some tasks and repetitions missing.

I tried using the aov function in R to perform a repeated measures ANOVA analysis, but later found out that this is not appropriate for unbalanced designs. Here is the sample of what I did:

> summary(aov(measure ~ arm*task + Error(subject/(arm*task)), data=all_data))

Error: subject
          Df Sum Sq Mean Sq F value Pr(>F)
arm        1 0.3240  0.3240   0.398  0.573
task       4 0.1426  0.0357   0.044  0.994
Residuals  3 2.4397  0.8132               

Error: subject:arm
          Df Sum Sq Mean Sq F value Pr(>F)  
arm        1 0.0023 0.00234   0.074 0.8027  
task       4 0.9972 0.24931   7.941 0.0601 .
arm:task   1 0.0112 0.01117   0.356 0.5928  
Residuals  3 0.0942 0.03139                 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Error: subject:task
          Df Sum Sq Mean Sq F value Pr(>F)
task       5 0.3898 0.07795   1.652  0.172
arm:task   4 0.1482 0.03706   0.785  0.542
Residuals 35 1.6511 0.04718               

Error: subject:arm:task
          Df Sum Sq  Mean Sq F value Pr(>F)
arm:task   5 0.0352 0.007032   0.351  0.878
Residuals 35 0.7013 0.020036               

Error: Within
           Df Sum Sq  Mean Sq F value Pr(>F)
Residuals 203  1.288 0.006345               
Warning message:
In aov(measure ~ arm * task + Error(subject/(arm * task)),  :
  Error() model is singular

Why am I getting the warning message: "Error() model is singular"?

I also found that for unbalanced design it better to use the function anova() from the "car" package. I tried to search for the documentation for anova(), but I am very confused about how to use this function. Which model must I use for testing the following hypothesis: 1. Within-subjects there is no difference between the left and right arms. 2. Within-subjects there is no difference between the different tasks. 3. There is no interaction effect between arm and task within a subject.

It would also be very helpful if someone could point me to suitable books that can help me learn about these concepts.

$\endgroup$

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.