Rstan Versioning


I know this is a trivial question, but I don’t understand the versioning of rstan.

On one machine (conda envioroment), I have rstan_2.21.2 installed. According to github and Anaconda-Cloud the second to last version.

However, I have a model which fails consistency but works on another machine., which does have rstan_2.26.3 installed .

So my question basically is, what is 2.26.3.
And should I worry about the model failing on 2.21.2 but passing all testes in 2.26.3 or could I just go with this version than?

Failing here means:

  • all transitions exceed max treedepth
  • huge R-Hat
  • ESS to low

thanks in advance


please ignore the Github listed versions, that have not been regularly updated (I went ahead and removed the listing of releases on Github). Here is the rundown:

  • RStan 2.21 is available on CRAN and can be installed using:
remove.packages(c("rstan", "StanHeaders"))
install.packages("rstan", repos = c("", getOption("repos")))
  • There is an experimental branch of rstan available on github, that is up-to-date with current Stan version, but I would not install that if you are not trying to work on rstan source code or if you do not have experience with installing packages from source and dealing with any R-package related issues

  • Stan (the backend of rstan) is currently at version 2.29. That is available through other interfaces like CmdStan (and its CmdStanR/Py wrappers) and PyStan3

If you do not need to use the CRAN version of rstan (some companies only allow installing CRAN packages), I would suggest installing rstan 2.26 as it is faster, more up-to-date and has additional bugfixes, one of the most pronounced ones is the beta_binomial_lpmf function, which was faulty for the 2.21 release.

1 Like

Thanks a lot.

That actually explains my problems on the first machine exactly, since i am using a beta binomial.

Just for completeness: That means, similar to CRAN, if I want/have to stick with conda and anaconda-cloud I also have to use 2.21, correct?

Yes, if you want to use conda and stick with rstan, then for now you need to stay with 2.21. We probably should upgrade rstan on Conda

Side note: @WardBrian do you know how we can push our Rstan binaries on Conda?

There are other interfaces on Conda that you can use if you want to keep being up-to-date:

I have zero experience with Conda so I unfortunately cant help or provide more detail w.r.t. those packages.

We can open pull requests to GitHub - conda-forge/r-rstan-feedstock: A conda-smithy repository for r-rstan. (and r-stanheaders-feedstock). I don’t know the maintainers there, but I think this would probably be good if we opened them to the “release candidate” or “beta” channel until 2.26 is on CRAN.

I can look into this today, I know more about conda than R, though