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

Short course on Bayesian data analysis and Stan 18-20 July in NYC!

Jonah Gabry, Vince Dorie, and I are giving a 3-day short course in two weeks. Before class everyone should install R, RStudio and RStan on their computers. (If you already have these, please update to the latest version of R and the latest version of Stan, which is 2.10.) If problems occur please join the […]

Euro 2016 update

Big news out of Europe, everyone’s talking about soccer. Leo Egidi updated his model and now has predictions for the Round of 16: Here’s Leo’s report, and here’s his zipfile with data and Stan code. The report contains some ugly histograms showing the predictive distributions of goals to be scored in each game. The R […]

YouGov uses Mister P for Brexit poll

Ben Lauderdale and Doug Rivers give the story: There has been a lot of noise in polling on the upcoming EU referendum. Unlike the polls before the 2015 General Election, which were in almost perfect agreement (though, of course, not particularly close to the actual outcome), this time the polls are in serious disagreement. Telephone […]

Reduced-dimensionality parameterizations for linear models with interactions

After seeing this post by Matthew Wilson on a class of regression models called “factorization machines,” Aki writes: In a typical machine learning way, this is called “machine”, but it would be also a useful mode structure in Stan to make linear models with interactions, but with a reduced number of parameters. With a fixed […]

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). […]

Stan makes Euro predictions! (now with data and code so you can fit your own, better model)

Leonardo Egidi writes: Inspired by your world cup model I fitted in Stan a model for the Euro Cup which start today, with two Poisson distributions for the goals scored at every match by the two teams (perfect prediction for the first match!). Data and code are here. Here’s the model, and here are the […]

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 […]

Stan workshop this Thurs NYC

Jonah is speaking at the Bayesian Data Analysis meetup on Thursday night, “Stan Workshop. Life is precious: fix your sampling problems.” He’ll focus on common problems using MCMC and how to address them. For registration: http://www.meetup.com/bda-group/events/231650672/

Stan on the beach

This came in the email one day: We have used the great software Stan to estimate bycatch levels of common dolphins (Delphinus delphis) in the Bay of Biscay from stranding data. We found that official estimates are underestimated by a full order of magnitude. We conducted both a prior and likelihood sensitivity analyses : the […]

Stan talk in Seattle on Tuesday, May 17

I (Eric) will be giving a Stan talk at the Seattle useR Group next week. Daniel Lee and Ben Goodrich will be there as well. If you are in the Seattle area on Tuesday, please stop by and say hello. Thanks to Zach Stednick for organizing this meetup.

Gary Venter’s age-period-cohort decomposition of US male mortality trends

Following up on yesterday’s post on mortality trends, I wanted to share with you a research note by actuary Gary Venter, “A Quick Look at Cohort Effects in US Male Mortality.” Venter produces this graph: And he writes: Cohort effects in mortality tend to be difficult to explain. Often strings of coincidences are invoked – […]

Lots of buzz regarding this postdoc position in London

Tom Churcher writes: We are currently advertising for an infectious disease modeller to investigate the impact of insecticide resistance on malaria control in Africa. The position is for 3 years in the first instance and is funded by the Wellcome Trust. No previous malaria or mosi experience required. Please circulate to anyone who might be […]

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 […]

Data-dependent prior as an approximation to hierarchical model

Andy Solow writes: I have a question about Bayesian statistics. Why is it wrong to use the same data to formulate the prior and to update it to the posterior? I am having a hard time coming up with – or finding in the literature – a formal reason. I asked him to elaborate and […]

I definitely wouldn’t frame it as “To determine if the time series has a change-point or not.” The time series, whatever it is, has a change point at every time. The question might be, “Is a change point necessary to model these data?” That’s a question I could get behind.

From the Stan users list: I’m trying out to fit a time series that can have 0 or 1 change point using the sample model from Ch 11.2 of the manual. To determine if the time series has a change-point or not, would I need to do comparison model (via loo) between 1-change model developed […]

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 […]

Stan backronym just a joke

Stan is named after Stanislaw Ulam, the inventor of the Monte Carlo method. At one point we were joking around and I came up with the backronym Sampling Through Adaptive Neighborhoods. I kinda like this as a backronym but it was really just a joke. Stan does not stand for Sampling Through Adaptive Neighborhoods. Stan […]

Bayesian inference for network links

A colleague writes: I’m working with a doctoral student on a latent affinity network problem and we keep hitting challenges in sampling, in our case using Metropolis-Hastings, for the network links. As you can imagine, lots of local modes, things get stuck, etc . . . Any suggestions on how to sample network links? My […]

Stan – The Bayesian Data Scientist’s Best Friend

My friend Juuso Parkkinen has interesting Stan related blog, which is worth following. The above cool animation is from today’s post discussing the updated results of using Stan to model apartment prices in Finland. Few weeks ago Juuso also blogged about a probabilistic programming seminar in Finland with a title Stan – The Bayesian Data […]