Learn R Programming

oeli (version 0.5.2)

rwishart: Draw from Wishart distribution

Description

This function draws from a Wishart or Inverse-Wishart distribution.

Usage

rwishart(df, scale, inv = FALSE)

Value

A matrix, the random draw.

Arguments

df

An integer, the degrees of freedom. Must be greater or equal p.

scale

A matrix, the scale matrix of dimension p x p. Must be a covariance matrix.

inv

A logical, if TRUE the density of the Inverse-Wishart distribution is returned. By default, inv = FALSE.

Examples

Run this code
df <- 4
scale <- diag(2)
rwishart(df = df, scale = scale)
rwishart(df = df, scale = scale, inv = TRUE)

Run the code above in your browser using DataLab