View source: R/RandomEffects.R
rRxNorm | R Documentation |
Sample from the conditional parameter distribution given the data and hyperparameters of the Multivariate-Normal Random-Effects (mNormRE) model (see Details).
rRxNorm(n, x, V, lambda, Sigma)
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 |
Consider the hierarchical multivariate normal model
μ ~ N(λ, Σ) x | μ ~ N(μ, V).
The Multivariate-Normal Random-Effects model μ ~ RxNorm(x, V, λ, Σ) on the random vector μ_q is defined as the posterior distribution p(μ | x, λ, Σ). This distribution is multivariate normal; for the mathematical specification of its parameters please see vignette("mniw-distributions", package = "mniw")
.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.