# In glmer, can I treat both like a random effect and a fixed effect the same factor?

I conducted a memory study and used glmer to find if there was an interaction between time and condition, i.e., if the slopes were different between conditions. It is a repeated measures analysis. I ran this model:

MODEL <- glmer(accuracy ~ time * condition
+ (1 + time|subject)
+ (1|item),
data = data,
family = "binomial",
control = glmerControl(optimizer = "bobyqa"))


I found that the difference was not significant, so I was asked to make an analysis based on participants' performance, i.e., if the subjects with good accuracy at time 1, regardless of the condition, have different slopes than the ones with bad accuracy at 1. In other words, if there is a correlation between the slopes and the intercepts by subject.

After reading about the interpretation of glmer, I understood that this is accounted for by (1 + time|subject), but I am not sure, because I was asked to create a new variable (performance) and split subjects between good and bad, and then run a model like this:

MODEL2 <- glmer(accuracy ~ time * performance
+ (1 + time|subject)
+ (1|item),
data = data,
family = "binomial",
control = glmerControl(optimizer = "bobyqa"))


I am not sure if this makes sense, or if I'm good to go with the first model. If the first model is correct, where in the output of summary(MODEL) can I find if there is a significant correlation between the intercept and the slope of the subjects?

I am afraid that if I remove condition from the model, the model will explain very little of the data, but adding both performance and condition seems a bit redundant.

Variances and correlations between random effects can be found in summary(model), after formula and goodness-of-fit measures. In the dummy example below, the correlation between time and intercept is -0.42:

Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) [glmerMod]
Family: binomial  ( logit )
Formula: accuracy ~ time * condition + (1 + time | subject) + (1 | item)
Data: data

AIC      BIC   logLik deviance df.resid
5513.1   5581.4  -2747.6   5495.1    14635

Random effects:
Groups   Name                  Std.Dev. Corr
subject  (Intercept)           58.3290
time                  27.6648  -0.42


However, as you can see there is no significance or confidence interval attached to this correlation. One way to address that question is to test whether the correlation is important to explain the data, which you can do by comparing models with and without the correlation parameter:

m1 <- glmer(accuracy ~ time*condition + (0 + time|subject) + (1|subject) + (1|item),
data = data, family = "binomial")
m2 <- glmer(accuracy ~ time*condition + (1 + time|subject) + (1|item),
data = data, family = "binomial")
anova(m1,m2)


Here is an excellent introduction to linear mixed models for your field, with valuable references:

Singmann, H., & Kellen, D. (2017). An introduction to mixed models for experimental psychology. In New Methods in Neuroscience and Cognitive Psychology. Psychology Press Hove.