Learn R Programming

mixtools (version 0.3.0)

dmvnorm: The Multivariate Normal Density

Description

Density and log-density for the multivariate normal distribution with mean equal to mean and variance matrix equal to sigma.

Usage

dmvnorm(y, mean=NULL, sigma=NULL)
logdmvnorm(y, mean=NULL, sigma=NULL)

Arguments

y
Either a d-vector or an $n\times d$ matrix, where $d$ is the dimension of the normal distribution and $n$ is the number of points at which the density is to be evaluated.
mean
$d$-vector: Mean of the normal distribution (or NULL uses the origin as default)
sigma
$d\times d$ matrix: Variance matrix of the normal distribution (or NULL uses the identity matrix as default)

Value

  • dmvnorm gives the densities, logdmvnorm gives the logarithm of the densities

Details

This code is written to be efficient, using the qr-decomposition of the covariance matrix (and using it only once, rather than recalculating it for both the determinant and the inverse of sigma).

See Also

qr, qr.solve, dnorm, rmvnorm