brm_prior_simple {brms.mmrm}R Documentation

Simple prior for a brms MMRM

Description

Generate a simple prior for a brms MMRM.

Usage

brm_prior_simple(
  data,
  formula,
  intercept = "student_t(3, 0, 2.5)",
  coefficients = "student_t(3, 0, 2.5)",
  sigma = "student_t(3, 0, 2.5)",
  correlation = "lkj(1)"
)

Arguments

data

A tidy data frame with one row per patient per discrete time point.

formula

An object of class "brmsformula" from brm_formula() or brms::brmsformula(). Should include the full parameterization of the model, including fixed effects, residual correlation, and heterogeneity in the discrete-time-specific residual variance components.

intercept

Character of length 1, Stan code for the prior to set on the intercept parameter.

coefficients

Character of length 1, Stan code for the prior to set independently on each of the non-intercept model coefficients.

sigma

Character of length 1, Stan code for the prior to set independently on each of the log-scale standard deviation parameters. Should be a symmetric prior in most situations.

correlation

Character of length 1, Stan code for the prior on the correlation matrix for the residuals of a given patient. (Different patients are modeled as independent, and each patient has the same correlation structure as each other patient.) Should be an LKJ prior in most situations.

Details

In brm_prior_simple(), you can separately choose priors for the intercept, model coefficients, log-scale standard deviations, and pairwise correlations between time points within patients. However, each class of parameters is set as a whole. In other words, brm_prior_simple() cannot assign different priors to different fixed effect parameters.

Value

A classed data frame with the brms prior.

Examples

set.seed(0L)
data <- brm_simulate_outline()
data <- brm_simulate_continuous(data, names = c("age", "biomarker"))
formula <- brm_formula(
  data = data,
  baseline = FALSE,
  baseline_time = FALSE
)
brm_prior_simple(
  data = data,
  formula = formula,
  intercept = "student_t(3, 0, 2.5)",
  coefficients = "normal(0, 10)",
  sigma = "student_t(2, 0, 4)",
  correlation = "lkj(2.5)"
)

[Package brms.mmrm version 0.1.0 Index]