# Modelling clustered data using boosted regression trees

I'm modelling habitat selection using boosted regression trees (BRTs), which I prefer over linear models for a variety of reasons (modeling complex nonlinear relationships and interactions, multicollinearity, etc.). I now have a dataset that includes repeated measures for individual animals (100s or 1000s per individual). In a linear modeling framework this is easily analyzed with random effects, but I haven't found any way to model clustered data with BRTs.

I found methods that produce individual regression trees (e.g., Mixed Effect Regression Trees (MERT), Regression Trees with Random Effects (REEMtree)). But the only mention I've found of random effects with BRTs is in Buston and Elith 2011 (http://onlinelibrary.wiley.com/doi/10.1111/j.1365-2656.2011.01803.x/abstract), who did a post-hoc residuals analysis to identify group effects. Is there any way to account for clustering within the BRT analysis itself? Thanks!

• Are you aware of Mixed-effects random forest? – Randel Jul 27 '15 at 20:26
• Thanks Randel. Yes, I read that paper and tried contacting the first author for the R program, but got an auto-reply saying she's on maternity leave. Can you or anyone else point me to a copy of the R code? – Michel Jul 27 '15 at 21:20
• I am not sure if I have the right to share their code. But we wrote a simplified function MixRF. It's based on lme4 so there are many possibilities. Maybe you can try the example therein. – Randel Jul 28 '15 at 4:29
• We wrote a open-source Python implementation of mixed effects random forests from the paper quoted above. You can easily extend to make the base learner a boosted regression tree if you want. towardsdatascience.com/… github.com/manifoldai/merf – Sourav Dey Jun 24 '18 at 3:23