Mixed effects logistic regression type model in R - GLMER problems I'm doing a project where I have students listen to 7 stimuli (all students listen to the same 7), and then say for each one whether that stimuli sounds more like PALM or TRAP. There are two groups of students, groupA and groupB (GroupA is younger than GroupB). I want to measure if the difference between their groups in their selection of choice PALM or TRAP across the stimuli is significant or not.
I've been told to do a mixed effects logistic regression type model in R, but I've not used glmer much and I find it hard to use. The only way I could get it to work was to put in the SUBJECT as a slope (?), but that doesn't seem right to me and the result is odd. I would really appreciate any suggestions to neaten the code for what I'm trying to do (or possible alternatives).
My current code in R is this, where CHOICE = outcome resulting in choice of either PALM or TRAP, STIMULUS = stimuli 1 through to 7, GROUP = GroupA or GroupB, and SUBJECT is the participant ID (although I wondered if I should even keep this in) :
table <- read.delim("rawdata2.txt", stringsAsFactors = TRUE)
table

summary(table)

library (lmerTest)
library (lme4)

table$GROUP <- as.factor(table$GROUP)
table$STIMULUS <- as.numeric(table$STIMULUS)
table$CHOICE <- as.factor(table$CHOICE)
table$SUBJECT <- as.numeric(table$SUBJECT)

contrast <- cbind(c(-0.5, +0.5))
colnames(contrast) <- c("-PALM+TRAP")
contrasts (table$CHOICE) <- contrast

contrast <- cbind(c(-0.5, +0.5))
colnames(contrast) <- c("-A+B")
contrasts (table$GROUP) <- contrast

#Fixed effects = STIMULUS, GROUP
#Random effects = CHOICE
# Within-participants = STIMULUS, CHOICE
# Between-Paticipants = GROUP, SUBJECT
# Running into errors if I leave out SUBJECT, but should it even be there?

model <- glmer(CHOICE ~ STIMULUS * GROUP + (STIMULUS | SUBJECT) + (STIMULUS * GROUP | SUBJECT), data = table, family = binomial)
model

Response in the console:
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
 Family: binomial  ( logit )
Formula: CHOICE ~ STIMULUS * GROUP + (STIMULUS | SUBJECT) + (STIMULUS *      GROUP | SUBJECT)
   Data: table
      AIC       BIC    logLik  deviance  df.resid 
 438.0945  507.8760 -202.0473  404.0945       431 
Random effects:
 Groups    Name               Std.Dev. Corr             
 SUBJECT   (Intercept)        2.9190                    
           STIMULUS           0.5851   -1.00            
 SUBJECT.1 (Intercept)        2.7501                    
           STIMULUS           0.5386   -1.00            
           GROUP-A+B          4.2917    0.57 -0.56      
           STIMULUS:GROUP-A+B 0.8327   -0.56  0.55 -0.99
Number of obs: 448, groups:  SUBJECT, 16
Fixed Effects:
       (Intercept)            STIMULUS           GROUP-A+B  STIMULUS:GROUP-A+B  
           -4.2495              0.9265              1.2539             -0.2695  
optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 2 lme4 warnings 03 

 A: I suspect that there is either extremely small variation of STIMULUS within SUBJECT, or that the random structure you have specified is too complex to be supported by the data.
Also, it would appear tha GROUP does not vary within SUBJECT, so if you include GROUP as part of a random slope (ie STIMULUS * GROUP) then you are asking for trouble.
The first step should be to fit this model:
CHOICE ~ STIMULUS * GROUP + (1 | SUBJECT)

If this converges without warning or error, then you could try introducing random slopes for STIMULUS:
CHOICE ~ STIMULUS * GROUP + (STIMULUS | SUBJECT)

but don't be surprised if you obtain a singular fit (meaning that random slopes, correlated with random intercepts are not supported by the data). If so then the next model would be to fit slopes uncorrelated with intercepts:
CHOICE ~ STIMULUS * GROUP + (STIMULUS || SUBJECT)

And if this doesn't work, then just go back to the random interepts only model.
Alternatively, since all students listen to the same 7 stimuli, you could fit crossed random effects:
CHOICE ~ GROUP + (1 | STIMULUS) + (1 | SUBJECT)

and if this converges without warning or error I would suggest this model, provided that you are not specifically interested in the interaction between GROUP and STIMULI.
