rRxNorm {mniw} | R Documentation |
Conditional sampling for Multivariate-Normal Random-Effects model.
Description
Sample from the conditional parameter distribution given the data and hyperparameters of the Multivariate-Normal Random-Effects (mNormRE) model (see Details).
Usage
rRxNorm(n, x, V, lambda, Sigma)
Arguments
n |
Integer number of random samples to generate. |
x |
Data observations. Either a vector of length |
V |
Observation variances. Either a matrix of size |
lambda |
Prior means. Either a vector of length |
Sigma |
Prior variances. Either a matrix of size |
Details
Consider the hierarchical multivariate normal model
The Multivariate-Normal Random-Effects model on the random vector
is defined as the posterior distribution
. This distribution is multivariate normal; for the mathematical specification of its parameters please see
vignette("mniw-distributions", package = "mniw")
.
Examples
# data specification
q <- 5
y <- rnorm(q)
V <- rwish(1, diag(q), q+1)
# prior specification
lambda <- rep(0,q)
A <- diag(q)
n <- 10
# random sampling
rRxNorm(n, y, V, lambda, A)