StanEstimators Initial Release and RFC: Estimating R functions using Stan!

I’m very happy to announce the first ‘stable’ release of StanEstimators!

This package allows you to use Stan’s algorithms directly with R functions, requiring no Stan code at all. Gradients can either be specified by the user or estimated automatically using finite-differences. The package is standalone (no dependency on rstan or cmdstanr) and tracks the latest Stan release (2.33.1).

Examples for usage can be seen in the package vignette and the package readme.

I’m aiming to submit to CRAN after the next Stan release (2.34), so this is also a request for testing and comments!

Release link: Release StanEstimators v0.1.0 - Initial Release · andrjohns/StanEstimators · GitHub

What’s New

All of Stan’s algorithms are now fully supported for use with arbitrary R functions:

  • HMC/NUTS Sampling (including multiple parallel chains)
  • MLE Optimisation
  • Laplace Approximation
  • Variational Inference
  • Pathfinder

All standard model methods are now available:

  • log_prog
  • grad_log_prob
  • hessian
  • unconstrain_variables
  • unconstrain_draws
  • constrain_variables

As well as support for approximate LOO-CV via loo(), and moment-matching with loo(., moment_match = TRUE)

Full Changelog: Commits · andrjohns/StanEstimators · GitHub

12 Likes