Description Usage Arguments See Also Examples
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.
1 
... 
One or more terms containing grouping factors. 
by 
An optional factor variable, specifying subpopulations of the
groups. For each level of the 
cor 
Logical. If 
id 
Optional character string. All grouplevel terms across the model
with the same 
cov 
An optional matrix which is proportional to the withongroup
covariance matrix of the grouplevel effects. All levels of the grouping
factor should appear as rownames of the corresponding matrix. This argument
can be used, among others, to model pedigrees and phylogenetic effects. See

dist 
Name of the distribution of the grouplevel effects.
Currently 
1 2 3 4 5 6 7 8 9 10 11 12 13 14  ## Not run:
# model using basic lme4style formula
fit1 < brm(count ~ Trt + (1patient), data = epilepsy)
summary(fit1)
# equivalent model using 'gr' which is called anyway internally
fit2 < brm(count ~ Trt + (1gr(patient)), data = epilepsy)
summary(fit2)
# include Trt as a by variable
fit3 < brm(count ~ Trt + (1gr(patient, by = Trt)), data = epilepsy)
summary(fit3)
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.