I know this question is a bit general, I don't have and reproducible code to share, since it's a general question, I'm trying to understand where to start the investigation about it: I would like to perform statistical analysis using repeated measures mixed model, the model needs to include 2 levels of repeatedness, How can I do it in R?
-
2Your question is too broad to provide a specific answer. Could you clarify what you mean with "2 levels of repeatedness"? `lme4` and `nlme` both provide options to include multiple levels of nesting. Three-level models might be what you're looking for, see: https://rpsychologist.com/r-guide-longitudinal-lme-lmer – Niek Nov 08 '19 at 14:46
1 Answers
You appear to be asking about a study design which includes 2 levels of nesting, for example this would be the case in a study that made repeated measurements within many schools, and also repeated measurements within classrooms within the schools. So here you would have classrooms nested within schools. Each classroom "belongs" to a particular school.
This type of design can be modelled with a mixed effects model, or a multilevel model (which in this case would essentially be the same). In R, one of the standard packages to analyse such data is lme4
.
Note that here we would be dealing with 2 levels of nested (grouping) factors. A different scenario occurs where we have two grouping factor variables that are not nested : that is, they are crossed. A typical scenario is where individuals are measured repeatedly doing different tasks, but all individuals perform the same tasks.
More details about the distinction, and how to model these in the lme4
package can be found here:
Crossed vs nested random effects: how do they differ and how are they specified correctly in lme4?

- 53,316
- 10
- 84
- 148