[R-sig-ME] Specification of Random structure in glmer()

Tibor Kiss t|bor@k|@@ @end|ng |rom ruhr-un|-bochum@de
Thu May 18 13:09:55 CEST 2023


Dear List Members,

I am somewhat confused about the random structures of two models. I’ll try to explain the problem without the code, which is available at https://github.com/Linguistic-Data-Science-Lab/SimRandom. 

I am assuming a binomial model with glmer with random slopes for subjects for two treatment coded factors (A, B) with two values (A1, A2, and B1, B2, respectively, A1 and B1 being reference levels) and their interaction as follows:

M1: glmer(CHOICE ~ A * B + (0 + A * B | subjects) + (1 | items), data = ..., family = …) 

For this model, I am getting a random values for all four combinations A1B1, …, A2B2 for the subjects.

I have also defined another model, which only differs from the first one in the treatment of the intercept in the random structure:

M2: glmer(predicted_value ~ A * B + (1 + A * B | subjects) + (1 | items), data = ..., family = …) 

Now I would expect that the random slopes for the two models are related as follows (illustrated here for A2B1):

random slope for A2B1(M1) = random intercept for A1B1(M2) + random slope for A2B1(M2) 

This works out for the random intercept and the first random slope in M2. As an illustration consider the first subject:

A2B1(M1) = -0.05; intercept(M2) = 0.11, A2B1(M2) = -0.16.

Now I would expect that these equivalences hold for the other random slopes as well, but the values for the random slopes of A1B2 and A2B2 are identical in both models.  

I would have expected A1B2(M1) = A1B1(M2) + A1B2(M2), but instead, it is A1B2(M1) = A1B2(M2).  
I would also have expected A2B2(M1) = A1B1(M2) + A2B1(M2) + A1B2(M2) + A2B2(M2), but again, what I get is A2B2(M1) = A2B2(M2).

My question is: is my specification of the models wrong or is there something else that I have missed?


Thank you very much


Tibor



More information about the R-sig-mixed-models mailing list