Learn R Programming

brms (version 0.5.0)

brmdata: Extract required data for brms models

Description

Extract required data for brms models

Usage

brmdata(formula, data = NULL, family = "gaussian", autocor = NULL,
  partial = NULL, cov.ranef = NULL, ...)

Arguments

formula
An object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under 'Details'.
data
An optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model. If not found in data, the variables are taken from environment(formula), typically the e
family
A vector of one or two character strings. The first string indicates the distribution of the dependent variable (the 'family'). Currently, the following families are supported: "gaussian", "student", "cauchy",
autocor
An optional cor_brms object describing the correlation structure within the response variable (i.e. the 'autocorrelation'). See the documentation of cor_brms
partial
A one sided formula of the form ~expression specifying the predictors with category specific effects in non-cumulative ordinal models (i.e. in families "cratio", "sratio", or "acat").
cov.ranef
A list of matrices that are proportional to the (within) covariance structure of the random effects. The names of the matrices should correspond to columns in data that are used as grouping factors. All levels of the grouping factor should
...
Other arguments for internal usage only

Value

  • A named list of objects containing the required data to fit a brms model

Examples

Run this code
data1 <- brmdata(rating ~ treat + period + carry + (1|subject),
                 data = inhaler, family = "cumulative")
names(data1)

data2 <- brmdata(count ~ log_Age_c + log_Base4_c * Trt_c + (1|patient) + (1|visit),
                 data = epilepsy, family = "poisson")
names(data2)

Run the code above in your browser using DataLab