Hi. Philip Greengard is working on an idea to speed up computation for hierarchical linear models by doing some of the algebra directly.

Does anyone have a good example of a hierarchical linear regression that is of applied interest where it runs too slowly to be practical in full Stan? In particular we’re looking for examples with large N.

Once we have an example we will write this up, and it may be that others are doing very similar things and we can collaborate.

Linear in the sense that it has a single continuous numeric predictor of the outcome, or would something with a contrast matrix with lots of columns (each of which containing rows that are either -1/+1) work too?

And a Gaussian outcome only, or could binomial work too? I actually have a dataset (https://dalspace.library.dal.ca/xmlui/handle/10222/74191) with joint modelling of a hierarchical binomial outcome, and a hierarchical Gaussian outcome with effects on both the mean and sd. Can’t remember how long it takes to sample, but I think at least overnight (possibly therefore too small for your demonstration if you’re looking for something real that takes a week or more). Oh, though actually, I have a larger database (same data as reported here: https://pubmed.ncbi.nlm.nih.gov/20804252/ ) of similar data I haven’t modelled in this way yet with about 10x more data as I recall, though somewhat fewer columns in the contrast matrix.

Hi @mike-lawrence - in the current setup, the outcome is continuous and is modeled as a linear combination of predictors, not necessarily one predictor but potentially hundreds or thousands. Binomial could also work, but I’m not sure at the moment. I would be interested in seeing your Stan model to make sure I understand your problem (if you don’t mind sharing).

Ah, the scenario I have data for only has max a dozen columns in the predictor matrix. Around a thousand people each measured many times in each unique combination of the predictors. The model I’d run is in the osf link above.