dbarts
dbarts copied to clipboard
Random slopes in rbart
Hi - I'm interested in estimating a multilevel model with both a random intercept and random linear slope for a level 1 predictor via BART: e.g., if u(xi) and s(xi) are BART forests something like:
yij = u(xi) + (s(xi)+RandomSlope)*variable_of_interest + RandomInterceptj + eij
Is there any way I can do that currently with rbart? Or are you looking to add functionality in that way in the future?
Really appreciate the work on this package, and thanks in advance for your help.
Howdy,
Not at the moment, at least not without writing your own sampler. The pieces are all there they just have to be put together. I can go into some detail about how to do this, but it would look pretty similar to the sampling loop in [rbart_vi_fit](https://github.com/vdorie/dbarts/blob/master/R/rbart.R)
if you're comfortable with that.
One of the impediments to these kinds of models is having to produce updates for the covariance matrix of the random effects. It shouldn't be too bad for a single random slope but I'm currently working on integrating Stan to do this in the general case. However, I envisioned this more as a non-parametric version of lme4, wherein the BART component wouldn't interact with the random effects but instead replace the fixed-effect terms. If there's sufficient interest I can think about what the interface for the kind of model you propose would look like.
Hi - thanks for that - it sounds like the architecture for allowing multiple random effects is in the works - I assume once you've done that it will at least be substantially easier to accommodate the kinds of models I'm describing - I'll keen an eye out for the update re Stan.
It doesn't fully address the question but VCBART can handle similar models without the random slope. E.g. y_ij = beta_0(z_ij) + beta_1(z_ij) * [variable of interest X1_ij] + ... + correlated noise
The full random effect varying intercept/varying slope Stan package is actually implemented and is (slowly) on its way to CRAN. It doesn't yet allow you to have more than one BART component at the moment, but you can easily fit:
- yij = u(xi, variable_of_interest_ij) + RandomSlope_j * variable_of_interest_ij + RandomInterceptj + eij