I have data like This (repeated measures), Testscore
is the dependent variable, Time
is the measurement time.
| ID | TIME | TESTSCORE | VAR1 | VAR2 |
|:-- |:----:|:---------:|:----:|:----:|
|20 |1 | 100 | 50 | 0 |
|20 |2 |200 | 60 | 1 |
|30 |3 | 400 | 70 | 0 |
|30 |2 | -100 | 200 | 1 |
|30 |1 | 500 | 100 | 1 |
This is my Code so far:
library(lme4)
library(lmerTest)
library(jtools)
mmodel <- lmer (Testscore ~ var1 + var2 + (1|ID), data = DB)
summ(mmodel)
Two questions:
- Is This a correct mixed model code? I don't know if the code takes into account the Time variable which represent the repeated measures for each participant
- Is ID a correct Random effect? or should I replace it with Time. Thanks.