Just chasing a text/resource for learning hierarchical modelling in (and) R. I have extensive experience using Matlab and Stata but very limited R experience.
Any recommendations? Happy to purchase material if necessary.
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.Sign up to join this community
If you just want a practical guide to fitting mixed models / multilevel models, then the link provided by Mark White is a very good one:
However, if you seek to understand the theory, then I would highly recommend looking at mixed models - of which multilevel models can be thought of as a sub-type, then I would suggest the following:
Demidenko, E. (2013). Mixed models: theory and applications with R. John Wiley & Sons.
Bates, D. M. (2010). lme4: Mixed-effects modeling with R.
Bates, D., Mächler, M., Bolker, B., & Walker, S. (2014). Fitting linear mixed-effects models using lme4. arXiv preprint arXiv:1406.5823.
The latter two are both available for free on the internet.
My favorite is: https://rpsychologist.com/r-guide-longitudinal-lme-lmer. He shows both commonly-used packages, and he includes the equations alongside the code—so you can easily reference back to books from there.
Take a look at these:
GLMM FAQ Ben Bolker and others: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html
nlme package: https://cran.r-project.org/web/packages/nlme/nlme.pdf, which allows non- linear mixed models and correlations structures
I built R a package recently on Bayesian network modeling.
In the package description page you'll find varies examples of hierarchical models, their CPDs, graphical models structures, learning/inference algorithms and the corresponding R code.