Helper functions for Stan/rstan