New rstanarm user, having issues running my first model (error says there is a bug)

Hello! I am new to rstanarm, and am having trouble getting up and running.

I tried to follow the instructions in a previous post about this, but it still isn’t work for me. I was able to install rstan and rstanarm, but then can’t get a basic model to work.

Any help you could offer would be greatly appreciated!!

Here is what I am trying to run in RStudio:

library(rstan)
library(rstanarm)
library(nlme)
data("Machines")  # the data

fit2a <- stan_glmer(score ~  -1 + Machine + (1|Worker), data=Machines)

Here is the error I am getting:

SAMPLING FOR MODEL 'continuous' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0.000101 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 1.01 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
[1] "Error in sampler$call_sampler(args_list[[i]]) : " "  c++ exception (unknown reason)"                
error occurred during calling 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
  • rstan version: 2.21.2 (GitRev: 2e1f913d3ca3)
  • rstanarm Version: 2.21.2
  • RStudio version: 1.2.5042
  • R version 3.6.1 (2019-07-05)
  • Running under: macOS Catalina 10.15.4

It is hard to get rstanarm to work with R 3.6.x, although if you want to try you need to do

install.packages("rstanarm", type = "source")

But honestly, it is easier to upgrade to R 4.0.x in which case you can just install everything from binaries.

Awesome, I will update R version, install from binaries, and report back!!

1 Like