Skip to contents

Variational approximation for linear mixed model assuming Gaussian distribution priors on fixed and grouped effects. Priors on the variance parameters are Scaled-Inverse-Wishart distributions.

Usage

vb_lmm(
  y,
  X,
  Zlist,
  J,
  R,
  mu_beta0,
  Sigma_beta0,
  xi_sigma,
  Lambda_sigma,
  xi_k,
  Lambda_k,
  tol = 1e-08,
  maxiter = 100L,
  verbose = FALSE,
  trace = FALSE
)

Arguments

y

The response vector

X

The design matrix

Zlist

Collection of group design matrices

J

First dimension of each Z in Zlist (e.g. number of subjects/sites)

R

Second dimension of each Z in Zlist (e.g. number of variables, intercept and slope would be R = 2)

mu_beta0

The prior mean for beta

Sigma_beta0

The prior covariance for beta

xi_sigma

The first prior parameter for covariance Sigma

Lambda_sigma

The second prior parameter for covariance Sigma

xi_k

A vector of first covariance parameters for hierarchical covariance

Lambda_k

A list of second covariance parameters for hierarchical covariance

tol

Tolerance level

maxiter

Maximum iterations

verbose

Print trace of the lower bound to console. Default is FALSE.

trace

Print a trace of `mu` to console.

Value

A list containing:

converged

Indicator for algorithm convergence.

elbo

Vector of the ELBO sequence.

mu

The optimised value of mu.

Sigma

The optimised value of Sigma.