Sam Jones
Sam Jones

Reputation: 25

lmer issues with singularity

I am trying to run random-slopes and cross-level interaction multilevel models on a repeated-measures dataset using the lmer package. Participants came in and watched 5 different categories of videos. I want to examine the interaction of a participant-level variable (e.g., extraversion) and video category (e.g., videos involving parties, videos not involving parties, videos involving animals, etc.) on an outcome variable (e.g., positive affect).

Before entering the model, I made the video category variable a factor and I releveled the video category variable so that the reference category would be "neutral videos". I also centered my participant level variable. When I run the model this way I receive a singularity warning.

I played around with the variables and found if I enter the video category without relevelling and the uncentered participant-level variable , the singulairty warning goes away. Does anyone know what I might be doing wrong here?

#Centering extraversion

df$centered.extrav <- (df$extrav - mean(df$extrav, na.rm=TRUE))

#Creating and releveling factor

vid_type.f <- as.factor(df$vid_type)
vidcategory_ <- relevel(vid_type.f,ref = "Neutral")

#Random-slopes (with releveled factor)

mlm1.2 <- 
  lmer(pos_affect ~ vidcategory_ + (1 + vidcategory_|PID), data=df, REML=FALSE)

#Cross-level interaction (with centered variable)

mlm1.3 <- 
  lmer(pos_affect ~ 1 + vidcategory_ + centered.extrav + vidcategory_:centered.extrav + (1+ vidcategory_|PID),
       data=df, REML = FALSE)

Upvotes: 1

Views: 52

Answers (0)

Related Questions