(This article was originally published at Statistical Modeling, Causal Inference, and Social Science, and syndicated at StatsBlogs.)
I know I promised I wouldn’t blog, but this one is so clean and simple. And I already wrote it for the stan-users list anyway so it’s almost no effort to post it here too:
A colleague and I were working on a data analysis problem, had a very simple overdispersed Poisson regression with a hierarchical, varying-intercept component. Ran it and it was super slow and not close to converging after 2000 iterations. Took a look and we found the problem: The predictor matrix of our regression lacked a constant term. The constant term comes in by default if you do glmer or rstanarm, but if you write it as X*beta in a Stan model, you have to remember to put in a column of 1’s in the X matrix (or to add a “mu” to the regression model), and we’d forgotten to do that.
Once we added in that const term, the model (a) ran much faster (cos adaptation was smoother) and (b) converged just fine after just 100 iterations.
Yet another instance of the folk theorem.
The post A little story of the Folk Theorem of Statistical Computing appeared first on Statistical Modeling, Causal Inference, and Social Science.
Please comment on the article here: Statistical Modeling, Causal Inference, and Social Science
