Specifying R-side and G-side Random Effects in brms

SAS PROC Glimmix permits both R-side and G-side random effects to be specified where the R-side, often the within individual error /residual that arises from either Repeated measures( or a time based multiple) measures, can be specified as an AR(1). The G-side represents the standard covariance matrix (of random intercept and/or random slope) at the group-ID level.

I can specify these models in “nlme” for example using:

rside_gside <- lme(sales ~ tv80+digital30+search50, random = ~1|storeid, correlation=corAR1(form=~1|storeid), data=storesales)

How do I specify both the R-side and G-side in brms?

Thanks

Sree

Hi Sree,

G-side effects are specified using lme4-style syntax, so a G-side only model would look like:

gside <- brms(sales ~ tv80 + digital30 + search50 + (1|storeid),
              data=storesales)

R-side effects are specified using brms's autocor functions. For a list of these and how specify them, see the doc here: http://paul-buerkner.github.io/brms/reference/autocor-terms.html

So an R-side only model would look like:

rside <- brms(sales ~ tv80 + digital30 + search50 + ar(gr=storeid),
              data=storesales)

Naturally, a model combining R-side and G-side effects would then be:

rside_gside <- brms(sales ~ tv80 + digital30 + search50 +
                            ar(gr=storeid) + (1|storeid),
                    data=storesales)
2 Likes

@andrjohns thank you so much for the set of succinct examples. Thanks for the reference too. I will review the notes.

Sree

1 Like