I have narrowed down some specific questions and was advised that it's more appropriate to post them here than on stackoverflow
I'm building a growth curve model using lmer in R and I'm unsure about some of the steps.
I have a study where 20 participants see 20 cues, and for each cue they give 20 responses, and I believe there is a time component to the responses (i.e. they are not given in a random order, so that's why I'm looking at a longitudinal analysis). Currently my baseline model looks like this
Model0 <- lmer(logRT~ (1|Cue) + (1|Participant), data=Data, REML=FALSE)
Random effects:
Groups Name Variance Std.Dev.
Participant (Intercept) 0.042230 0.2055
Cue (Intercept) 0.003943 0.0628
Residual 0.224097 0.4734
I want to add a variable that corresponds to the response number (1 to 20), which I'm thinking of as the time variable, and test whether a quadratic model of the change over time fits better than a linear model. But I'm not sure how to code that and how to interpret the results.
So would this be the right code
QuadrTime <- Time^2
Time_linear <- lmer(logRT~ Time + (1|Cue) + (1|Participant), data=Data, REML=FALSE)
Time_quadratic <- lmer(logRT~ Time + QuadrTime + (1|Cue) + (1|Participant), data=Data, REML=FALSE)
or can the first Time be excluded in the Time_quadratic model?
Second, can the Time variable be nested within something? in this case, Time corresponds to 20 responses that participants give to each cue, and for each cue the responses are slightly different (and will have different values of subsequent predictors) so is it possible to code it as:
Time_quadratic <- lmer(logRT~ (Time/Cue) + (QuadrTime/Cue) + (1|Cue) + (1|Participant), data=Data, REML=FALSE)