5
$\begingroup$

I think this means an unequal sample in different conditions. But it seems to mean something else. . .

I have a data set like below

particip    group   device  width   length  accep   thresh  rating  d-rating
1           RA      Dingo   nom     nom     Y       5       8       3
1           RA      Dingo   nom     long    Y       4       6       2
1           RA      Dingo   fat     nom     Y       4       6       2
1           RA      Dingo   fat     long    N       6       4      -2

and I'm running an ANOVA on it like so

aov.AMIDS_d <- aov(d.rating ~ group*device*width*length + Error(particip/(device*width*length))+group,data.AMIDS_d) 

This works ok until I try to print the condition means like so

print(model.tables(aov.AMIDS_d,"means"),digits=3)

and it says

Error in model.tables.aovlist(aov.AMIDS_d, "means") : design is unbalanced so cannot proceed

According to the design, it ought to be balanced, so I need to check my data structure. I tried

table(data.AMIDS_d[,2:5])

to give a table of observations per condition and got this

, , width = fat, length = long

     device
group Dingo SNAR
   NR    12   12
   NV    12   12
   RA    12   12

, , width = nom, length = long

     device
group Dingo SNAR
   NR    12   12
   NV    12   12
   RA    12   12

, , width = fat, length = nom

     device
group Dingo SNAR
   NR    12   12
   NV    12   12
   RA    12   12

, , width = nom, length = nom

     device
group Dingo SNAR
   NR    12   12
   NV    12   12
   RA    12   12

which looks both correct and balanced. So what is causing the unbalanced design error?

$\endgroup$
0

1 Answer 1

5
$\begingroup$

In case anyone else has this problem, check that your all your factor columns, particularly any containing numbers and including your participant-identifier column, are classed as a Factor and not as an Integer by using str(yourdata) or class(yourdata$columnname). My particular culprit was the participants column.

If it's classed as an Integer, then

yourdata$columnname <- as.factor(yourdata$columnname)

will re-class it as a factor.

$\endgroup$
1
  • 4
    $\begingroup$ Nice find, Krysta. A tip for future situations: checking the df in your model outputs is always a good diagnostic; doing so in this case would have made this particular problem easy to spot. $\endgroup$ Commented May 22, 2013 at 19:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.