useR!2017 has ended
Back To Schedule
Thursday, July 6 • 2:24pm - 2:42pm
How to Use (R)Stan to Estimate Models in External R Packages

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Feedback form is now closed.
Keywords: Bayesian, developeRs
Webpages: rstan, rstanarm, rstantools, StanHeaders, bayesplot, shinyStan, loo, home page
The rstan package provides an interface from R to the Stan libraries, which makes it possible to access Stan’s advanced algorithms to draw from any posterior distribution whose density function is differentiable with respect to the unknown parameters. The rstan package is ranked in the \(99\)-th percentile overall on Depsy due to its number of downloads, citations, and use in other projects. This talk is a follow-up to the very successful Stan workshop at useR2016 and will be more focused on how maintainers of other R packages can easily use Stan’s algorithms to estimate the statistical models that their packages provide. These mechanisms were developed to support the rstanarm package for estimating regression models with Stan and have since been used by over twenty R packages, but they are perhaps not widely known and difficult to accomplish manually. Fortunately, the rstan_package.skeleton function in the rstantools package can be used to automate most of the process, so the package maintainer only needs to write the log-posterior density (up to a constant) in the Stan language and provide an R wrapper to call the pre-compiled C++ representation of the model. Methods for the resulting R object can be defined that allow the user to analyze the results using post-estimation packages such as bayesplot, ShinyStan, and loo.
References Carpenter, Bob, Andrew Gelman, Matthew Hoffman, Daniel Lee, Ben Goodrich, Michael Betancourt, Marcus Brubaker, Jiqiang Guo, Peter Li, and Allen Riddell. 2017. “Stan: A Probabilistic Programming Language.” Journal of Statistical Software 76 (1): 1–32. doi:10.18637/jss.v076.i01.


Thursday July 6, 2017 2:24pm - 2:42pm CEST
3.01 Wild Gallery