Search code examples
rstanrstan

How to view warnings for incorrect Stan model in rstan?


Currently, if I make a typo in *.stan file (forget a trailing semicolon for example), and then run the model in R, it just silently quits without showing any error messages:

library(rstan)

fit <- stan(file="mymodel.stan", data=c(1,2))

Is there a way to see compilation errors for my Stan model? Something like

Semicolon missing on line 13


Solution

  • This answer should not be necessary for much longer into the future, but in the recent past you may need to do

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

    in order to correctly handle the exceptions that are thrown when parsing invalid Stan programs under the Catalina version of the Mac OSX operating system.