rpeIW: Parameter expanded inverse Wishart (co)variance.

View source: R/priors.R

rpeIWR Documentation

Parameter expanded inverse Wishart (co)variance.

Description

Simulate prior (co)variance matrix according to the inverse Wishart distribution with parameter expansion on the hyperparameters.

Usage

rpeIW(n = 1, V, nu, alpha.mu, alpha.V)

Arguments

n

Integer of how many samples to generate.

V

Numeric matrix of the expected (co)variances

nu

Numeric for the degree of belief parameter for the inverse- Wishart.

alpha.mu

Numeric vector of means for the redundant working parameters.

alpha.V

Numeric matrix of the covariance matrix for the redunant working parameters.

Details

Details on the meaning of V, nu, alpha.mu, alpha.V can be found in the MCMCglmm documentation covering the way to specify variance structure priors in the prior argument.

Value

A numeric vector (if the dimensions of V are 1) or matrix where each row designates a sampled (co)variance and the columns contain the matrix elements for the prior covariance matrix.

Author(s)

matthewwolak@gmail.com

See Also

MCMCglmm, rIW

Other prior functions: dIW()

Examples

set.seed(101)
(peIW <- rpeIW(n = 5, V = diag(2), nu = 3,
alpha.mu = rep(0, 2), alpha.V = diag(2)*1000))
sapply(1:5, FUN = function(i){matrix(peIW[i, ], 2, 2)}, simplify = "array")

matthewwolak/wolakR documentation built on May 10, 2023, 1:27 p.m.