dmvnorm_cholesky_inverse: Evaluate density of multivariate Normal

Description Usage Arguments Details Value See Also Examples

View source: R/multivariatenormal.R

Description

Function to evaluate a multivariate Normal density of each row of the given matrix, where the covariance matrix is specified through a Cholesky factor of its inverse.

Usage

1
dmvnorm_cholesky_inverse(x, mean, cholesky_inverse)

Arguments

x

is a n x d matrix of real values

mean

is the mean vector

cholesky_inverse

is a Cholesky factor of the inverse of the covariance matrix; for instance obtained as t(chol(solve(covariance))).

Details

This function does not check anything (i.e. that the given covariance is PSD). Thus it is faster than functions in standard packages, but more risky.

Value

a vector of n log-density evaluations

See Also

rmvnorm, rmvnorm_cholesky, dmvnorm

Examples

1
2
3
x <- rmvnorm(10, rep(0, 5), diag(1, 5, 5))
dmvnorm_cholesky_inverse(x, rep(-1, 5), t(chol(solve(diag(2, 5, 5)))))
# mvtnorm::dmvnorm(x, rep(-1, 5), diag(2, 5, 5), log = T)

pierrejacob/PET documentation built on May 25, 2019, 11:35 p.m.