dmvnorm: The Multivariate Normal Density

View source: R/dmvnorm.R

dmvnormR Documentation

The Multivariate Normal Density

Description

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

Usage

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

Arguments

y

Either a d - vector or an n x 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.

mu

d - vector: Mean of the normal distribution (or NULL uses the origin as default)

sigma

This d x d matrix is the variance matrix of the normal distribution (or NULL uses the identity matrix as default)

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).

Value

dmvnorm gives the densities, while logdmvnorm gives the logarithm of the densities.

See Also

qr, qr.solve, dnorm, rmvnorm


mixtools documentation built on Dec. 5, 2022, 5:23 p.m.