MyNixOS website logo
Description

Cholesky Decomposition of the Wishart Distribution.

Sampling from the Cholesky factorization of a Wishart random variable, sampling from the inverse Wishart distribution, sampling from the Cholesky factorization of an inverse Wishart random variable, sampling from the pseudo Wishart distribution, sampling from the generalized inverse Wishart distribution, computing densities for the Wishart and inverse Wishart distributions, and computing the multivariate gamma and digamma functions. Provides a header file so the C functions can be called directly from other programs.

Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. AppVeyor BuildStatus codecov R buildstatus Licence lifecycle


minimal Rversion CRAN_Status_Badge packageversion


Last-changedate

CholWishart

The most common use for this package is likely fast sampling from the inverse Wishart or use of the multivariate gamma or digamma functions. This is a package for fast computation of various functions related to the Wishart distribution, such as sampling from the Cholesky factorization of the Wishart, sampling from the inverse Wishart, sampling from the Cholesky factorization of the inverse Wishart, sampling from the pseudo Wishart, computing densities for the Wishart and inverse Wishart, and computing a few auxiliary functions such as the multivariate gamma and digamma functions. Many of these functions are written in C to maximize efficiency.

The output of the sampling functions is in the same format as the output of stats::rWishart().

The main idea: sampling for multivariate or matrix variate statistics often makes use of distributions related to the Wishart. There are implementations in a few packages but they are often in R and much slower than the basic stats::rWishart() or there is a lot of associated overhead in the package. Here, then, is a small package with some of those distributions and related functions. As the name suggests, the initial purpose was sampling from the Cholesky factorization of a Wishart distribution.

Usage

The package offers the following distributions:

  • The inverse Wishart:
rInvWishart(n = 1,df = 5,Sigma = diag(4)))
  • The Cholesky decomposition of the inverse Wishart:
rInvCholWishart(n = 1,df = 5,Sigma = diag(4)))
  • The Cholesky decomposition of the Wishart
rCholWishart(n = 1,df = 5,Sigma = diag(4)))
  • The pseudo Wishart and its pseudo-inverse, the generalized inverse Wishart (df less than the dimension of Sigma minus 1):
rPseudoWishart(n = 1,df = 3,Sigma = diag(5)))
rGenInvWishart(n = 1,df = 3,Sigma = diag(5)))
  • The package also offers density functions for the Wishart and inverse Wishart distributions:
dInvWishart(x = diag(4), df = 5, Sigma = diag(4), log = TRUE)
dWishart(x = diag(4), df = 5, Sigma = diag(4), log = TRUE)

In addition to this, the package offers the multivariate gamma function and multivariate digamma function, the multivariate counterparts of the gamma and digamma (derivative of the log of the gamma) functions.

mvgamma(x = 5, p = 3)
mvdigamma(x = 5, p = 3)

I suspect the most useful functions for most people will be the mvgamma and rInvWishart functions.

Installation

Now available on CRAN, install it at:

install.packages('CholWishart')

Install the latest development version at:

# install.packages('devtools')
devtools::install_github("gzt/CholWishart")

Calling from other packages

The header inst/install/CholWishart.h is available so that the exported functions can be called in C from other packages.

Contributing

Please note that the ‘CholWishart’ project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Metadata

Version

1.1.2

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows