Learn R Programming

MultiRNG (version 1.2.4)

draw.wishart: Pseudo-Random Number Generation under Wishart Distribution

Description

This function implements pseudo-random number generation for a Wishart distribution with pdf

$$f(x|\nu,\Sigma)=(2^{\nu d/2}\pi^{d(d-1)/4}\prod_{i=1}^{d}\Gamma((\nu+1-i)/2))^{-1}|\Sigma|^{-\nu/2}|x|^{(\nu-d-1)/2}\exp(-\frac{1}{2}tr(\Sigma^{-1}x))$$

\(x\) is positive definite, \(\nu \geq d\), and \(\Sigma\) is symmetric and positive definite, where \(\nu\) and \(\Sigma\) are positive definite and the scale matrix, respectively.

Usage

draw.wishart(no.row,d,nu,sigma)

Arguments

no.row

Number of rows to generate.

d

Number of variables to generate.

nu

Degrees of freedom.

sigma

Scale matrix.

Value

A \(no.row \times d^2\) matrix of Wishart deviates in the form of rows.To obtain the Wishart matrix, convert each row to a matrix where rows are filled first.

See Also

draw.d.variate.normal

Examples

Run this code
# NOT RUN {
mymat<-matrix(c(1,0.2,0.3,0.2,1,0.2,0.3,0.2,1), nrow=3, ncol=3)
draw.wishart(no.row=1e5,d=3,nu=5,sigma=mymat)
# }

Run the code above in your browser using DataLab