subject <- factor(rep(c(1,2,3,4,5,6,7),each=4, times=2))
dep <- c(5,4,9,3,4,4,2,1,10,7,8,7,1,2,1,1,5,10,1,7,3,2,1,4,3,8,7,3,1,1,2,1,15,10,20,11,2,2,1,3,11,12,9,7,2,3,1,2,11,9,8,9,3,4,2,1)
f1 <- factor(rep(c(rep("Female",times=16),rep("Male",times=12)), times=2))
f2 <- factor(rep(c("day1","day2","day3","day4"),times=14))
data <- data.frame(sub=subject, dep=dep, f1=f1, f2=f2)
m <- lmer(dep ~ f1*f2 + (1|sub), data=data)
I'm trying to understand how I can test the assumptions for mixed models.
1) In the case of model m, should I look at homogeneity of variances for every combination of f1
and f2
like this plot(resid(m)~fitted(.)|f1:f2)
or is it enough to simply do plot(resid(m))
?
2) In either case my real model is showing a funnel shape, is this too problematic? What would you do in that case?
3) How can I check the linearity assumption for each categorical variable in R?
4) Apart from homogeneity of variances and normality of residuals, are there any other important assumptions that you think I should be aware of?