Last data update: 2014.03.03

R: The Inverse Wishart Distribution
InvWishartR Documentation

The Inverse Wishart Distribution

Description

Density function and random generation from the Inverse Wishart distribution.

Usage

   diwish(W, v, S)
   riwish(v, S)

Arguments

W

Positive definite matrix W (p x p).

v

Degrees of freedom (scalar).

S

Scale matrix (p x p).

Details

The mean of an inverse Wishart random variable with v degrees of freedom and scale matrix S is 1/(v-p-1) S.

Value

diwish evaluates the density at positive definite matrix W. riwish generates one random draw from the distribution.

Examples

density <- diwish(matrix(c(2,-.3,-.3,4),2,2), 3, matrix(c(1,.3,.3,1),2,2))
draw <- riwish(3, matrix(c(1,.3,.3,1),2,2))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MCMCpack)
Loading required package: coda
Loading required package: MASS
##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2016 Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0350646 and SES-0350613)
##
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MCMCpack/iwishart.Rd_%03d_medium.png", width=480, height=480)
> ### Name: InvWishart
> ### Title: The Inverse Wishart Distribution
> ### Aliases: diwish riwish InvWishart
> ### Keywords: distribution
> 
> ### ** Examples
> 
> density <- diwish(matrix(c(2,-.3,-.3,4),2,2), 3, matrix(c(1,.3,.3,1),2,2))
> draw <- riwish(3, matrix(c(1,.3,.3,1),2,2))
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>