'response is constant' error when running glmer?

Hi all! Super new to R so totally lost on what I'm doing.. trying to run a series of multilevel regression using the lme4 code, but whenever I try and run the baseline glmer I get a 'response is constant' error. Does anyone know how I can fix this, or what I need to change?


> library(haven)
> hi <- read_sav("Desktop/hi.sav")
> View(hi)
> ppt=hi$ppt
> acc=as.numeric(hi$ACC)
> acc=ifelse(acc==2,1,0)
> HH=hi$HH
> bb=hi$BB
> SS=hi$SS
> CC=hi$CC
> BS=hi$BS
> HT=hi$HT
> HN=hi$HN
> CG=hi$CG
> HS=hi$HS
> TG=hi$TG
> FF=hi$FF
> RT=hi$RT
> library(Matrix)
> library(lme4)
> baselinemodel <- glmer(acc ~ (1|ppt), family = binomial)
Error: Response is constant

Hi Madeleine!

Since we don't have your data, it is hard to reproduce your problem, so please have a look at this thread to see how you can provide us with a dataset to reproduce your error.

Without knowing your data, it seems like your acc vector contains constant values, i.e. always the same value. In glmer, the argument left of the tilde (~) is the response argument. So maybe check the vector acc to see wether it only contains one value (either 0 or 1 I suppose).

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.