Skip to contents

Summarises the posterior of the OTU covariance matrix from a ZI_MLN() fit. By default the marginal covariance \(\Omega = \Lambda\Lambda' + (\sigma^2 + u_s^2) I\) is returned (the one whose correlation is posterior_correlation()). Set marginal = FALSE for the interaction covariance \(\Sigma = \Lambda\Lambda' + \sigma^2 I\), which excludes the subject random-effect variance.

Usage

posterior_covariance(fit, marginal = TRUE, ci = FALSE, prob = c(0.025, 0.975))

Arguments

fit

A list returned by ZI_MLN().

marginal

Logical; add the subject random-effect variance \(u_s^2\) to the diagonal (TRUE, default, giving \(\Omega\)) or not (FALSE, giving \(\Sigma\)).

ci, prob

As in posterior_correlation().

Value

A J x J posterior-mean covariance matrix, or a list of mean/lower/upper matrices when ci = TRUE.

Examples

# \donttest{
sim <- simulate_zimln(n = 20, J = 20, K = 2, seed = 1)
fit <- ZI_MLN(sim$Y, m = sim$m, M = sim$M, niter = 400, burnin = 200)
Sigma <- posterior_covariance(fit, marginal = FALSE)
# }