Learn R Programming

bayesm (version 3.0-2)

rwishart: Draw from Wishart and Inverted Wishart Distribution

Description

rwishart draws from the Wishart and Inverted Wishart distributions.

Usage

rwishart(nu, V)

Arguments

nu

d.f. parameter

V

pds location matrix

Value

W

Wishart draw

IW

Inverted Wishart draw

C

Upper tri root of W

CI

inv(C), \(W^{-1}\) = CICI'

Warning

This routine is a utility routine that does not check the input arguments for proper dimensions and type.

Details

In the parameterization used here, \(W\) \(\sim\) \(W(nu,V)\), \(E[W]=nuV\).

If you want to use an Inverted Wishart prior, you must invert the location matrix before calling rwishart, e.g. \(\Sigma\) \(\sim\) IW(nu,V); \(\Sigma^{-1}\) \(\sim\) \(W(nu,V^{-1})\).

References

For further discussion, see Bayesian Statistics and Marketing by Rossi, Allenby and McCulloch, Chapter 2. http://www.perossi.org/home/bsm-1

Examples

Run this code
##
set.seed(66)
rwishart(5,diag(3))$IW

Run the code above in your browser using DataLab