# Repeated measures ANOVA for an experiment with missing values

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

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

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: