Learn R Programming

MCMCpack (version 1.7-1)

Wishart: The Wishart Distribution

Description

Density function and random generation from the Wishart distribution.

Usage

rwish(v, S)

dwish(W, v, S)

Value

dwish evaluates the density at positive definite matrix W. rwish generates one random draw from the distribution.

Arguments

v

Degrees of freedom (scalar).

S

Inverse scale matrix \((p \times p)\).

W

Positive definite matrix W \((p \times p)\).

Details

The mean of a Wishart random variable with v degrees of freedom and inverse scale matrix S is \(vS\).

Examples

Run this code

density <- dwish(matrix(c(2,-.3,-.3,4),2,2), 3, matrix(c(1,.3,.3,1),2,2))
draw <- rwish(3, matrix(c(1,.3,.3,1),2,2))

Run the code above in your browser using DataLab