I’ve long been a Bayes booster for a variety of reasons, so it’s been a while since I bothered looking at sheer “speed to achieve results” comparisons. I remembered that lme4::glmer was a particular headache for me in my pre-Bayes days, so I coded up a comparison and WOW!
Here’s a gist containing decently-commented code to simulate and fit data using both lme4 and a highly-optimized Stan model. The code permits you to vary the characteristics of the data, but generally produces a hierarchical within-subjects design completely crossing each of a specified number of two-level predictor variables with binomial outcomes. In the stan code, I use both my reduced-redundant-computation trick as well as the sufficient statistics trick.
For a model with 3 predictor variables, 100 subjects and 100 observations per subject, Stan achieves 1000 decent-quality samples in UNDER A MINUTE. Meanwhile, lme4::glmer is failing to converge even after 30mins of running. (Going to try the newfangled “allFit()” approach to blanket try all the available optimizers)
Possibly this is unexpected to some with deeper intuitions/experience, but amid various claims online that “Bayes is slow” I thought I’d try to publicize this case as a strong counter-example.