Learn R Programming

brms (version 2.22.0)

unstr: Set up UNSTR correlation structures

Description

Set up an unstructured (UNSTR) correlation term in brms. The function does not evaluate its arguments -- it exists purely to help set up a model with UNSTR terms.

Usage

unstr(time, gr)

Value

An object of class 'unstr_term', which is a list of arguments to be interpreted by the formula parsing functions of brms.

Arguments

time

An optional time variable specifying the time ordering of the observations. By default, the existing order of the observations in the data is used.

gr

An optional grouping variable. If specified, the correlation structure is assumed to apply only to observations within the same grouping level.

See Also

autocor-terms

Examples

Run this code
if (FALSE) {
# add an unstructured correlation matrix for visits within the same patient
fit <- brm(count ~ Trt + unstr(visit, patient), data = epilepsy)
summary(fit)
}

Run the code above in your browser using DataLab