ldwishart: Log density for a Wishart variate

Description Usage Arguments Details Value Note Author(s) See Also Examples

Description

Computes log density for a Wishart random variable.

Usage

1
ldwishart(W, v, S)

Arguments

W

Wishart variate for which the log density is to be computed

v

degrees of freedom for the Wishart variate

S

scale factor for the Wishart variate (typically the inverse covariance if you are working with a multivariate random normal setup

Details

Computes the log density for a Wishart variate with mean S and degrees of freedom v. Special care has been taken to avoid underflow in the computation.

Value

A scalar, the value of the log density for the variate W with mean S and degrees of freedom v.

Note

This is modifed from the log density function in MCMCpack. It better handles underflows.

Author(s)

Patrick T. Brandt

See Also

rwishart

Examples

1
2
3
x <- matrix(rnorm(100), 50, 2)
XX <- crossprod(x)
ldwishart(solve(XX), 50, diag(2))

Example output

##
## MSBVAR Package v.0.9-2
## Build date:  Fri May 10 06:41:51 2019 
## Copyright (C) 2005-2019, Patrick T. Brandt
## Written by Patrick T. Brandt
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0351179, SES-0351205, SES-0540816, and SES-0921051)
##

[1] -337.6232

MSBVAR documentation built on May 30, 2017, 1:23 a.m.

Related to ldwishart in MSBVAR...