I have data of an experiment where subjects performed a task under 4 conditions (A1B1, A1B2, A2B1, A2B2, where A1/A2 are the levels of factor IV1 and B1/B2 those of IV2) with repeated measures on both factors, and I gather that one needs to account for a subject effect (id) — are these the residuals that should be normally distributed if I want the p-values of the IV1, IV2, IV1xIV2 effects from an ANOVA to be meaningful? In R:

fit <- lm(DV ~ IV1*IV2 + id, myData)


  • $\begingroup$ In the question you mention only IV1 and IV2 and their interaction but in the code there ia another variable id. What is id? $\endgroup$
    – user213325
    Apr 7, 2019 at 0:27
  • $\begingroup$ I've edited the question for clarity! $\endgroup$ Apr 7, 2019 at 7:20
  • 1
    $\begingroup$ How may subjects do you have ? A linear mixed model might be more appropriate if there are many. $\endgroup$ Apr 7, 2019 at 7:46
  • $\begingroup$ Unfortunately only 7 - would that be enough? $\endgroup$ Apr 7, 2019 at 13:59

1 Answer 1


Yes, those are the residuals you would check for normality. However, with repeated measures, a better approach, may be to use a linear mixed effects model, which will preserve the degrees of freedom that are used by fitting the id variable as a fixed effect. with the expense of estimating a variance for the random effect of id.

7 levels should be sufficient. Obviously, more is preferable, but note that the Dyestuff and Dyestuff2 datasets used as an example dataset included in lme4 has 6 levels of the grouping variable. If you use lme4 to fit the model in R then you can do so with:

lmer(DV ~ IV1*IV2 + (1|id), myData)

This will estimate simple, scalar random effects for id and these can be extracted and checked for normality, along with the unit-level residuals.

  • $\begingroup$ Thank you, Robert! Just a follow-up question. Each subject performed n repetitions (trials) of each of the 4 IV1 x IV2 combinations. I am only entering the trial-average values when using either the anova or the LME models, yet it is correct to call this a repeated measures design – is this correct? $\endgroup$ Apr 7, 2019 at 18:19
  • $\begingroup$ It is not clear exactly what you mean. Please ask a new question, giving more details of exactly how you conducted the study. $\endgroup$ Apr 7, 2019 at 20:21

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.