dist.Normal.Inverse.Wishart: Normal-Inverse-Wishart Distribution

Description Usage Arguments Details Value Author(s) See Also Examples

Description

These functions provide the density and random number generation for the normal-inverse-Wishart distribution.

Usage

1
2
dnorminvwishart(mu, mu0, lambda, Sigma, S, nu, log=FALSE) 
rnorminvwishart(n=1, mu0, lambda, S, nu)

Arguments

mu

This is data or parameters in the form of a vector of length k or a matrix with k columns.

mu0

This is mean vector mu[0] with length k or matrix with k columns.

lambda

This is a positive-only scalar.

n

This is the number of random draws.

nu

This is the scalar degrees of freedom nu.

Sigma

This is a k x k covariance matrix Sigma.

S

This is the symmetric, positive-semidefinite, k x k scale matrix S.

log

Logical. If log=TRUE, then the logarithm of the density is returned.

Details

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.

Value

dnorminvwishart gives the density and rnorminvwishart generates random deviates and returns a list with two components.

Author(s)

Statisticat, LLC. software@bayesian-inference.com

See Also

dmvn and dinvwishart.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Example output



LaplacesDemon documentation built on July 9, 2021, 5:07 p.m.