dist.Normal.Inverse.Wishart | R Documentation |
These functions provide the density and random number generation for the normal-inverse-Wishart distribution.
dnorminvwishart(mu, mu0, lambda, Sigma, S, nu, log=FALSE)
rnorminvwishart(n=1, mu0, lambda, S, nu)
mu |
This is data or parameters in the form of a vector of length
|
mu0 |
This is mean vector |
lambda |
This is a positive-only scalar. |
n |
This is the number of random draws. |
nu |
This is the scalar degrees of freedom |
Sigma |
This is a |
S |
This is the symmetric, positive-semidefinite, |
log |
Logical. If |
Application: Continuous Multivariate
Density: p(\mu, \Sigma) = \mathcal{N}(\mu | \mu_0,
\frac{1}{\lambda}\Sigma) \mathcal{W}^{-1}(\Sigma | \nu,
\textbf{S})
Inventors: Unknown
Notation 1: (\mu, \Sigma) \sim \mathcal{NIW}(\mu_0, \lambda,
\textbf{S}, \nu)
Notation 2: p(\mu, \Sigma) = \mathcal{NIW}(\mu, \Sigma |
\mu_0, \lambda, \textbf{S}, \nu)
Parameter 1: location vector \mu_0
Parameter 2: \lambda > 0
Parameter 3: symmetric, positive-semidefinite
k \times k
scale matrix \textbf{S}
Parameter 4: degrees of freedom \nu \ge k
Mean: Unknown
Variance: Unknown
Mode: Unknown
The normal-inverse-Wishart distribution, or Gaussian-inverse-Wishart distribution, is a multivariate four-parameter continuous probability distribution. It is the conjugate prior of a multivariate normal distribution with unknown mean and covariance matrix.
dnorminvwishart
gives the density and
rnorminvwishart
generates random deviates and returns a list
with two components.
Statisticat, LLC. software@bayesian-inference.com
dmvn
and
dinvwishart
.
library(LaplacesDemon)
K <- 3
mu <- rnorm(K)
mu0 <- rnorm(K)
nu <- K + 1
S <- diag(K)
lambda <- runif(1) #Real scalar
Sigma <- as.positive.definite(matrix(rnorm(K^2),K,K))
x <- dnorminvwishart(mu, mu0, lambda, Sigma, S, nu, log=TRUE)
out <- rnorminvwishart(n=10, mu0, lambda, S, nu)
joint.density.plot(out$mu[,1], out$mu[,2], color=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.