Skip to content
Archive of posts filed under the Stan category.

“Worthwhile content in PNAS”

Ben Bolker sends an email with the above subject line, a link to this article, and the following content: Experimental evidence that hummingbirds can see purple … researchers used Stan to analyze the data … The article in question is called “Wild hummingbirds discriminate nonspectral colors” and is by Mary Caswell Stoddard, Harold Eyster, Benedict […]

StanCon 2020. A 24h Global Event. (More details, new talk deadline: July 1)

Date Confirmed: Thursday, 13 August 2020 The Stan Conference will be virtual this year! We are aiming for a 24-hour conference that can bring the global Stan community together. There will be 3 scheduled blocks of time, each with a plenary talk and discussion for six contributed talks. Since the conference is virtual, we’re distributing […]

Improving our election poll aggregation model

Luke Mansillo saw our election poll aggregation model and writes: I had a look at the Stan code and I wondered if the model that you, Merlin Heidemanns, and Elliott Morris were implementing was not really Drew Linzer’s model but really Simon Jackman’s model. I realise that Linzer published Dynamic Bayesian Forecasting of Presidential Elections […]

Election 2020 is coming: Our poll aggregation model with Elliott Morris of the Economist

Here it is. The model is vaguely based on our past work on Bayesian combination of state polls and election forecasts but with some new twists. And, check it out: you can download our R and Stan source code and the data! Merlin Heidemanns wrote much of the code, which in turn is based on […]

Faster than ever before: Hamiltonian Monte Carlo using an adjoint-differentiated Laplace approximation

Charles Margossian, Aki Vehtari, Daniel Simpson, Raj Agrawal write: Gaussian latent variable models are a key class of Bayesian hierarchical models with applications in many fields. Performing Bayesian inference on such models can be challenging as Markov chain Monte Carlo algorithms struggle with the geometry of the resulting posterior distribution and can be prohibitively slow. […]

Sequential Bayesian Designs for Rapid Learning in COVID-19 Clinical Trials

This from Frank Harrell looks important: This trial will adopt a Bayesian framework. Continuous learning from data and computation of probabilities that are directly applicable to decision making in the face of uncertainty are hallmarks of the Bayesian approach. Bayesian sequential designs are the simplest of flexible designs, and continuous learning capitalizes on their efficiency, […]

Super-duper online matrix derivative calculator vs. the matrix normal (for Stan)

I’m implementing the matrix normal distribution for Stan, which provides a multivariate density for a matrix with covariance factored into row and column covariances. The motivation A new colleague of mine at Flatiron’s Center for Comp Bio, Jamie Morton, is using the matrix normal to model the ocean biome. A few years ago, folks in […]

This one’s important: Bayesian workflow for disease transmission modeling in Stan

Léo Grinsztajn, Elizaveta Semenova, Charles Margossian, and Julien Riou write: This tutorial shows how to build, fit, and criticize disease transmission models in Stan, and should be useful to researchers interested in modeling the COVID-19 outbreak and doing Bayesian inference. Bayesian modeling provides a principled way to quantify uncertainty and incorporate prior knowledge into the […]

New report on coronavirus trends: “the epidemic is not under control in much of the US . . . factors modulating transmission such as rapid testing, contact tracing and behavioural precautions are crucial to offset the rise of transmission associated with loosening of social distancing . . .”

Juliette Unwin et al. write: We model the epidemics in the US at the state-level, using publicly available death data within a Bayesian hierarchical semi-mechanistic framework. For each state, we estimate the time-varying reproduction number (the average number of secondary infections caused by an infected person), the number of individuals that have been infected and […]

OK, here’s a hierarchical Bayesian analysis for the Santa Clara study (and other prevalence studies in the presence of uncertainty in the specificity and sensitivity of the test)

After writing some Stan programs to analyze that Santa Clara coronavirus antibody study, I thought it could be useful to write up what we did more formally so that future researchers could use these methods more easily. So Bob Carpenter and I wrote an article, Bayesian analysis of tests with unknown specificity and sensitivity: When […]

Stan pedantic mode

This used to be on the Stan wiki but that page got reorganized so I’m putting it here. Blog is not as good as wiki for this purpose: you can add comments but you can’t edit. But better blog than nothing, so here it is. I wrote this a couple years ago and it was […]

It’s “a single arena-based heap allocation” . . . whatever that is!

After getting 80 zillion comments on that last post with all that political content, I wanted to share something that’s purely technical. It’s something Bob Carpenter wrote in a conversation regarding implementing algorithms in Stan: One thing we are doing is having the matrix library return more expression templates rather than copying on return as […]

New Within-Chain Parallelisation in Stan 2.23: This One‘s Easy for Everyone!

What’s new? The new and shiny reduce_sum facility released with Stan 2.23 is far more user-friendly and makes it easier to scale Stan programs with more CPU cores than it was before. While Stan is awesome for writing models, as the size of the data or complexity of the model increases it can become impractical […]

Imperial College report on Italy is now up

See here. Please share your reactions and suggestions in comments. I’ll be talking with Seth Flaxman tomorrow, and we’d appreciate all your criticisms and suggestions. All this is important not just for Italy but for making sensible models to inform policy all over the world, including here.

Bayesian analysis of Santa Clara study: Run it yourself in Google Collab, play around with the model, etc!

The other day we posted some Stan models of coronavirus infection rate from the Stanford study in Santa Clara county. The Bayesian setup worked well because it allowed us to directly incorporate uncertainty in the specificity, sensitivity, and underlying infection rate. Mitzi Morris put all this in a Google Collab notebook so you can run […]

Simple Bayesian analysis inference of coronavirus infection rate from the Stanford study in Santa Clara county

tl;dr: Their 95% interval for the infection rate, given the data available, is [0.7%, 1.8%]. My Bayesian interval is [0.3%, 2.4%]. Most of what makes my interval wider is the possibility that the specificity and sensitivity of the tests can vary across labs. To get a narrower interval, you’d need additional assumptions regarding the specificity […]

Updated Imperial College coronavirus model, including estimated effects on transmissibility of lockdown, social distancing, etc.

Seth Flaxman et al. have an updated version of their model of coronavirus progression. Flaxman writes: Countries with successful control strategies (for example, Greece) never got above small numbers thanks to early, drastic action. Or put another way: if we did China and showed % of population infected (or death rate), we’d erroneously conclude that […]

Tracking R of COVID-19 & assessing public interventions; also some general thoughts on science

Simas Kucinskas writes:

Conference on Mister P online tomorrow and Saturday, 3-4 Apr 2020

We have a conference on multilevel regression and poststratification (MRP) this Friday and Saturday, organized by Lauren Kennedy, Yajuan Si, and me. The conference was originally scheduled to be at Columbia but now it is online. Here is the information. If you want to join the conference, you must register for it ahead of time; […]

More coronavirus research: Using Stan to fit differential equation models in epidemiology

Seth Flaxman and others at Imperial College London are using Stan to model coronavirus progression; see here (and I’ve heard they plan to fix the horrible graphs!) and this Github page. They also pointed us to this article from December 2019, Contemporary statistical inference for infectious disease models using Stan, by Anastasia Chatzilena et al. […]