2

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)
residuals(fit)

Thanks!

user3050269
  • 183
  • 9

1 Answers1

3

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.

Robert Long
  • 53,316
  • 10
  • 84
  • 148
  • 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? – user3050269 Apr 07 '19 at 18:19
  • It is not clear exactly what you mean. Please ask a new question, giving more details of exactly how you conducted the study. – Robert Long Apr 07 '19 at 20:21