Friday, December 13, 2013

Bob Carpenter: December 18th

Title: Stan: A Statistical Modeling Language and Compiler

Abstract: Stan (http://mc-stan.org/) is a modeling language derived loosely from BUGS/JAGS.  Rather than using Gibbs sampling, Stan uses (adaptive) Hamiltonian Monte Carlo sampling, which is implemented using automatic differentiation.  Stan is also compiled rather than interpreted and uses a more flexible, imperative language instead of BUGS's declarative graph-specification language. I'll start with the variable declarations and blocks used by Stan, with an emphasis on why they are organized as they are and how the modeling language constructs are converted to code for compilation. Variable types include constrained and unconstrained scalars, vectors, matrices, and arrays;  blocks include (transformed) data, (transformed) parameters, model, and generated quantities blocks, corresponding to how variables are used in Bayesian modeling.  I'll then discuss how Stan's implemented with automatic differentiation to automatically convert models from constrained to unconstrained parameter spaces and how we use template metaprogramming to implement vectorized probability functions up to a constant. I'll also mention some future applications of our optimization features:  maximum marginal likelihood point estimates and stochastic variational approximate Bayesian inference. If anyone's interested, I can also talk about what we've learned about open-source project management as the team and scope grow.