Time-series negative binomial multilevel regression


Is there any reference / tutorial on how to build a time-series negative binomial multilevel regression model? I’ve checked the bsts R package (https://cran.r-project.org/web/packages/bsts/bsts.pdf), but seems it doesn’t handle multilevel (hierarchical) regression models.

Any help is appreciated.

@lauren and I included an example of this in our tutorial at StanCon, which is based on an example we developed with @rtrangucci:


There’s an Rmarkdown file and Stan programs in the corresponding GitHub repository. It starts simple but eventually builds up to a hierarchical negative binomial model with a time series component.


Thanks so much @jonah! Really useful link.

1 Like

@jonah I went through the tutorial and it’s a great explanation. Is it possible to provide stan code used in this tutorial? or is it available somewhere? I am new to stan and it would be much easier to understand the tutorial if I can have the stan code.

1 Like

Hi @rabin glad you liked the tutorial! The Stan programs are all in the folder called stan_programs in @lauren’s GitHub repository: https://github.com/lauken13/Beginners_Bayes_Workshop/. If you click the green “code” button you should be able to download everything.

1 Like

Thank you very much @jonah!