Stan_glmer (probit) Error in new_CppObject_xp

Hello,

I am new to Stan and rstanarm and would like to fit a mixed-effects probit model using the stan_glmer function in the rstanarm library. The example data set can be constructed using the following:

data <- data.frame(id=rep(1:6,each=5), y=rep(0,30))

The outcome of interest is rate (roughly 2-5%) and in this simulated data set the outcome is constant and 0.

The model of interest is:

stan_glmer(y~ 1 + (1|id), data=data, family=binomial(link=‘probit’), refresh=0)

The following error is produced:

Error in new_CppObject_xp(fields$.module, fields$.pointer, …) :
Exception: mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=u1; dims declared=(1); dims found=() (in ‘model_bernoulli’ at line 67)

failed to create the sampler; sampling not done
Error in check_stanfit(stanfit) :
Invalid stanfit object produced please report bug
Error in dimnamesGets(x, value) :
invalid dimnames given for “dgCMatrix” object

Any insights to this error?

  • Operating System: Windows 10 (x86_64-w64-mingw32/x64 (64-bit))
  • R Version: 3.6.0 (2019-04-26)
  • rstanarm Version: 2.18.2

It does not currently work when the y values are either all 0 or all 1.

Thank you Ben for the prompt reply.