James Savage is teaching a one-day workshop on causal inference this coming Saturday (16 July) in New York using RStanArm. Here’s a link to the details: One-day workshop on causal inference Here’s the course outline: How do prices affect sales? What is the uplift from a marketing decision? By how much will studying for an […]

## Reproducible Research with Stan, R, knitr, Docker, and Git (with free GitLab hosting)

Jon Zelner recently developed a neat Docker packaging of Stan, R, and knitr for fully reproducible research. The first in his series of posts (with links to the next parts) is here: * Reproducibility, part 1 The post on making changes online and auto-updating results using GitLab’s continuous integration service is here: * GitLab continuous […]

## Log Sum of Exponentials for Robust Sums on the Log Scale

This is a public service announcement in the interest of more robust numerical calculations. Like matrix inverse, exponentiation is bad news. It’s prone to overflow or underflow. Just try this in R: > exp(-800) > exp(800) That’s not rounding error you see. The first one evaluates to zero (underflows) and the second to infinity (overflows). […]

## Betancourt Binge (Video Lectures on HMC and Stan)

Even better than binging on Netflix, catch up on Michael Betancourt’s updated video lectures, just days after their live theatrical debut in Tokyo. Scalable Bayesian Inference with Hamiltonian Monte Carlo (YouTube, 1 hour) Some Bayesian Modeling Techniques in Stan (YouTube, 1 hour 40 minutes) His previous videos have received very good reviews and they’re only […]

## A Primer on Bayesian Multilevel Modeling using PyStan

Chris Fonnesbeck contributed our first PyStan case study (I wrote the abstract), in the form of a very nice Jupyter notebook. Daniel Lee and I had the pleasure of seeing him present it live as part of a course we were doing at Vanderbilt last week. A Primer on Bayesian Multilevel Modeling using PyStan This […]

## Beautiful Graphs for Baseball Strike-Count Performance

This post is by Bob. I have no idea what Andrew will make of these graphs; I’ve been hoping to gather enough comments from him to code up a ggplot theme. Shravan, you can move along, there’s nothing here but baseball. Jim Albert created some great graphs for strike-count performance in a series of two […]

## Stan Coding Corner: O(N) Change-Point Program with Clever Forward-Backward Calculation

It’s so much fun to work in open source. Luke Wiklendt sent along this improved code for a change-point model calculation in Stan. With N data points in the time series, the version in the manual is O(N2), whereas the improved version is O(N). In practice, Luke says [the new code] results in a dramatic […]

*Stan Case Studies* Launches

There’s a new section of the Stan web site, with case studies meant to illustrate statistical methodologies, classes of models, application areas, statistical computation, and Stan programming. Stan Case Studies The first ten or so are up, including a grab bag of education models from Daniel Furr at U.C. Berkeley: Hierarchical Two-Parameter Logistic Item Response […]

## Kéry and Schaub’s *Bayesian Population Analysis* Translated to Stan

Hiroki ITÔ (pictured) has done everyone a service in translating to Stan the example models [update: only chapters 3–9 so far, not the whole book; the rest are in the works] from Marc Kéry and Michael Schaub (2012) Bayesian Population Analysis using WinBUGS: A Hierarchical Perspective. Academic Press. You can find the code in our […]

## McElreath’s *Statistical Rethinking: A Bayesian Course with Examples in R and Stan *

We’re not even halfway through with January, but the new year’s already rung in a new book with lots of Stan content: Richard McElreath (2016) Statistical Rethinking: A Bayesian Course with Examples in R and Stan. Chapman & Hall/CRC Press. This one got a thumbs up from the Stan team members who’ve read it, and […]

## Stan 2.9 is Here!

We’re happy to announce that Stan 2.9.0 is fully available(1) for CmdStan, RStan, and PyStan — it should also work for Stan.jl (Julia), MatlabStan, and StataStan. As usual, you can find everything you need on the Stan Home Page. The main new features are: R/MATLAB-like slicing of matrices. There’s a new chapter in the user’s […]

## Stan Puzzle 2: Distance Matrix Parameters

This puzzle comes in three parts. There are some hints at the end. Part I: Constrained Parameter Definition Define a Stan program with a transformed matrix parameter d that is constrained to be a K by K distance matrix. Recall that a distance matrix must satisfy the definition of a metric for all i, j: […]

## 4 for 4.0 — The Latest JAGS

This post is by Bob Carpenter. I just saw over on Martyn Plummer’s JAGS News blog that JAGS 4.0 is out. Martyn provided a series of blog posts highlighting the new features: 1. Reproducibility: Examples will now be fully reproducible draw-for-draw and chain-for-chain with the same seed. (Of course, compiler, optimization level, platform, CPU, and […]

## You’ll never guess what’s been happening with PyStan and PyMC—Click here to find out.

PLEASE NOTE: This is a guest post by Llewelyn Richards-Ward. When there are two packages appearing to do the same thing, lets return to the Zen of Python which suggests that: There should be one—and preferably only one—obvious way to do it. Why is this particular mantra important? I think because the majority of users […]

## Stan PK/PD Tutorial at the American Conference on Pharmacometrics, 8 Oct 2015

Bill Gillespie, of Metrum, is giving a tutorial next week at ACoP: Getting Started with Bayesian PK/PD Modeling Using Stan: Practical use of Stan and R for PK/PD applications Thursday 8 October 2015, 8 AM — 5 PM, Crystal City, VA This is super cool for us, because Bill’s not one of our core developers […]

## Solution to Stan Puzzle 1: Inferring Ability from Streaks

If you missed it the first time around, here’s a link to: Stan Puzzle 1: Inferring Ability from Streaks First, a hat-tip to Mike, who posted the correct answer as a comment. So as not to spoil the surprise for everyone else, Michael Betancourt (different Mike), emailed me the answer right away (as he always […]

## Stan Puzzle #1: Inferring Ability from Streaks

Inspired by X’s blog’s Le Monde puzzle entries, I have a little Stan coding puzzle for everyone (though you can solve the probabilty part of the coding problem without actually knowing Stan). This almost (heavy emphasis on “almost” there) makes me wish I was writing exams. Puzzle #1: Inferring Ability from Streaks Suppose a player […]

## PK/PD Talk with Stan — Thu 8 Oct, 10:30 AM at Columbia: Improved confidence intervals and p-values by sampling from the normalized likelihood

Sebastian Ueckert and France Mentré are swinging by to visit the Stan team at Columbia and Sebastian’s presenting the following talk, to which everyone is invited. Improved confidence intervals and p-values by sampling from the normalized likelihood Sebastian Ueckert (1,2), Marie-Karelle Riviere (1), France Mentré (1) (1) IAME, UMR 1137, INSERM and University Paris Diderot, […]