Learn R Programming

qbrms (version 1.0.1)

bf: Create a Bayesian Formula

Description

Function to set up a model formula for use in qbrms, allowing specification of distributional parameters (e.g., sigma) in addition to the mean structure.

Usage

bf(formula, ..., flist = NULL, family = NULL, nl = FALSE)

Value

An object of class brmsformula (and qbrmsformula) containing the parsed formulas.

Arguments

formula

Main model formula (for the mean/location parameter).

...

Additional formulas for distributional parameters (e.g., sigma ~ x).

flist

Optional list of formulas (for internal use).

family

Same as in qbrms() (optional here).

nl

Logical; indicating if the model is non-linear (not yet fully supported).

Details

This function mimics the brms::bf() syntax to allow users familiar with brms to define distributional models.

Supported distributional parameters depend on the family:

  • gaussian: sigma (residual standard deviation)

  • student_t: sigma, nu (degrees of freedom)

  • lognormal: sigma (shape parameter)

  • beta: phi (precision)

  • simplex: phi (precision)

Examples

Run this code
if (FALSE) {
# Standard model
f1 <- bf(y ~ x)

# Distributional model (heteroscedasticity)
# Sigma varies by group
f2 <- bf(y ~ x, sigma ~ group)
}

Run the code above in your browser using DataLab