R
package glmertree
allows for fitting decision trees to multilevel data. It allows for specifying a random effects structure, and partitioning the dataset into subgroups using predictors. (The method can correct for the level at which partitioning variables are measured through a cluster
argument)
For further reference, see the package vignette (tutorial): https://cran.r-project.org/web/packages/glmertree/vignettes/glmertree.pdf.
Fokkema, M., Smits, N., Zeileis, A., Hothorn, T., & Kelderman, H. (2018). Detecting treatment-subgroup interactions in clustered data with generalized linear mixed-effects model trees. Behavior research methods, 50(5), 2016-2034. https://doi.org/10.3758/s13428-017-0971-x
Fokkema, M., Edbrooke-Childs, J., & Wolpert, M. (20202021). Generalized linear mixed-model (GLMM) trees: A flexible decision-tree method for multilevel and longitudinal data. Psychotherapy Research, 31(3), 329-341. https://doi.org/10.1080/10503307.2020.1785037