How to deal with unbalanced group sizes in mixed design analysis? I have 2 x 2 x 2 mixed design with two between subject factors (sex, organizer) and one within subjects factor (task). The group sizes of the 'sex'-factor is unequal. When I perform a factorial repeated measures ANOVA, I get the following warning message: 

Warning: Data is unbalanced (unequal N per group). Make sure you
  specified a well-considered value for the type argument to ezANOVA().

I used the following model in R:
model <- ezANOVA(data=df, dv=.(top_start), wid=.(id), between=.(sex, org),
                         within=.(task), type = 3, detailed = TRUE)

I used type = 3 for the Anova because, as I understood, it is suited for unbalanced group sizes.
I have the following questions:


*

*Do I need to code contrasts when all my factors have only two levels?

*Did I use the right type of Anova?

*Are there other ways to do this analysis?

 A: If you use type 3 for ANOVAs it is critical in R that you set the contrast to effect coding (i.e., "contr.sum"). 
The default contrast in R is dummy coding (or in R parlance, treatment coding) in which 0 represents the first factor level. This doesn't make too much sense when having interactions as explaind on the page I linked to.
To set effect coding, run the following:
options(contrasts=c("contr.sum","contr.poly"))

Alternatively, you can use the afex package, which has similar goals as ez, with the difference that it automatically sets the contrasts to effects coding and uses type 3 as default.
A: I'm certainly no ANOVA expert but I guess the other way to do this analysis is to switch to a regression framework and use lme4 which doesn't mind unbalanced data and will itself work out what it 'between' and what is 'within'.  I believe the relevant line for an additive model would be 
mod0 <- lmer(top_start ~ (1 | id) + task + org + sex, data=df)

where you could add interactions/asterisks as appropriate.
