# Two factor ANOVA with repeated measures by mixed model (lmer) [duplicate]

I did a simple experiment with trees: 5 species (sp) and two management (trt). I assessed the diameter (diam) through the time (month=1:24) and I'm interesting in the factors interaction effect, I mean if the management is suitable for some species.

The dataset has some limitations since it is not balanced, so in 2 out of 10 factors combinations (sp*trt) I have 4 trees (subjects) and for the rest there are 5 trees:

       sp    trt trees
1       A      L     5
2       A      W     5
3       B      L     5
4       B      W     5
5       C      L     5
6       C      W     5
7       P      L     4
8       P      W     5
9       T      L     5
10      T      W     4


I fitted the following model:

m1 <- lmer(diam ~ trt * sp * month + (1|tree), data = dat1)


I'm not sure if I'm doing right, mainly if the model is right...

If the model is correct, and the anova is the following table:

Analysis of Variance Table
Df  Sum Sq Mean Sq F value
trt           1 0.12110 0.12110 17.3756
sp            4 0.06761 0.01690  2.4251
month         1 0.33917 0.33917 48.6659
trt:sp        4 0.00436 0.00109  0.1564
trt:month     1 0.15814 0.15814 22.6900
sp:month      4 0.24445 0.06111  8.7687
trt:sp:month  4 0.19109 0.04777  6.8547

• I vote to reopen. I don't understand why this was closed as off-topic. The question asks about how RM-ANOVA analogue can be performed via a mixed mode. This definitely does require a lot statistical expertise to answer! In fact, it's likely a duplicate, we have a bunch of threads on this topic, and they are well-upvoted and open. – amoeba Mar 30 '17 at 20:12
• Juanchi, your lmer formula looks fine to me. – amoeba Mar 30 '17 at 20:15
• thanks @amoeba. I didn't understand either why they closed it. Anyway.. I am oserving that residuals of this model are not so normally distributed (I added the plot to the OP). I also have the doubt if do I need to add the time to the subject (tree) as nested in the random effect... – Juanchi Mar 31 '17 at 0:00