| gr {brms} | R Documentation |
Function used to set up a basic grouping term in brms.
The function does not evaluate its arguments –
it exists purely to help set up a model with grouping terms.
gr is called implicitly inside the package
and there is usually no need to call it directly.
gr(..., by = NULL, dist = "gaussian")
... |
One or more terms containing grouping factors. |
by |
An optional factor variable, specifying sub-populations
of the groups. For each level of the |
dist |
Name of the distribution of the group-level effects.
Currently |
## Not run: # model using basic lme4-style formula fit1 <- brm(count ~ Trt + (1|patient), data = epilepsy) summary(fit1) # equivalent model using 'gr' which is called anyway internally fit2 <- brm(count ~ Trt + (1|gr(patient)), data = epilepsy) summary(fit2) # include Trt as a by variable fit3 <- brm(count ~ Trt + (1|gr(patient, by = Trt)), data = epilepsy) summary(fit3) ## End(Not run)