I am analyzing some data in R using the lmer function provided in the lme4 package. The experiment involves assigning a number of students to different trials of exam questions, and everone is assigned to the same three blocks of questions. The response of interests are Correct and RT, and I am considering doing two separate analyses with Correct and RT as the dependent variable respectively. The data looks like:
SubjectID Block.No TrialNo IsTrial Correct RT
136 332216 1 1 0 1 8306
137 332216 1 2 0 1 2076
138 332216 1 3 0 0 1051
139 332216 1 4 0 1 2864
140 332216 1 5 0 1 3516
141 332216 1 6 0 1 2494
142 332216 1 7 0 1 2260
143 332216 1 8 0 1 1852
144 332216 1 1 FASTER 0 1514
145 332216 1 2 FASTER 1 850
146 332216 1 3 FASTER 1 919
147 332216 1 4 FASTER 1 855
148 332216 1 1 1 0 1514
149 332216 1 2 1 1 1480
150 332216 1 3 1 1 863
151 332216 1 4 1 1 1270
152 332216 1 5 1 1 701
153 332216 1 6 1 1 835
154 332216 1 7 1 1 1317
155 332216 1 8 1 1 626
where the variable IsTrial
indicates whether the trial is an actual trial (some are practice), and observations with IsTrial
labeled other than 1 will be excluded from analysis. The variable TrialNo
is nested within Block.No
which is nested within SubjectID
. Questions in different blocks are different in terms of difficulty, so the same TrialNo in different blocks refers to different questions.
I am considering a linear mixed effects model, with SubjectID, Block.No, and TrialNo as random intercepts and some other variables as fixed effects, i.e.,
fit <- lmer(RT ~ 1 + some fixed effects + (1|SubjectID/Block.No/TrialNo)).
Now I am wondering what happens if I create a new variable that uniquely defines the grouping structure, taking into account all SubjectID, Block.No, and TrialNo. For example, in the first row, this new variable has value: 332216_1_1, in the second row, 332216_1_2, etc. In my new model, which looks like:
fit1 <- lmer(RT ~ 1 + some fixed effects + (1|new variable)),
I use only the new variable instead of the nested one as a random effect. I am wondering whether this is something plausible and what difference does the new model make?