density_normal: Multivariate normal probability density function

Description Usage Arguments Value Examples

Description

Multivariate normal probability density function

Usage

1
density_normal(x, mu, Sigma_inv, logret = FALSE)

Arguments

x

A numeric matrix, each column of which is a point at which the density is to be evaluated.

mu

A numeric vector, the mean of the distribution.

Sigma_inv

A numeric matrix, the precision matrix (inverse of the of the variance-covariance matrix) of the distribution.

logret,

a logical value indicating whether to return the log density. Defaults to FALSE.

Value

A column vector whose jth element is the density of a multivariate normal distribution with mean mu and precision matrix Sigma_inv evaluated at the jth column of x. If logret is true, the natural logarithm of the density is returned.

Examples

1
2
3
4
M <- matrix(c(1, 0.5, 0.5, 1), 2, 2)
m <- c(0, 0)
density_normal(cbind(c(0, 0), c(2, 2)), m, solve(M))
density_normal(cbind(c(0, 0), c(2, 2)), m, solve(M), TRUE)

fditraglia/zoofactr documentation built on May 16, 2019, 12:12 p.m.