dmvnorm: Multivariate normal distribution density function

dmvnormR Documentation

Multivariate normal distribution density function

Description

Calculates the probability density function of the multivariate normal distribution

Usage

dmvnorm(x, mu, Sigma, log = FALSE, tol = 1e-06)

Arguments

x

a vector or matrix of multivariate observations

mu

a vector or matrix of mean values

Sigma

a square variance-covariance matrix

log

(logical) return log-likelihood?

tol

tolerance for positive definiteness

Details

uses naive linear algebra – could probably use QR decomposition and/or crossprod.

Value

vector of log-likelihoods

Author(s)

Ben Bolker

See Also

mvrnorm (in MASS package), dmvnorm (in mvtnorm package)

Examples

M = matrix(c(1,0.5,0.5,0.5,1,0.5,0.5,0.5,1),nrow=3)
dmvnorm(1:3,mu=1:3,Sigma=M,log=TRUE)
dmvnorm(matrix(1:6,nrow=2),mu=1:3,Sigma=M,log=TRUE)
dmvnorm(matrix(1:6,nrow=2),mu=matrix(1:6,nrow=2),Sigma=M,log=TRUE)

emdbook documentation built on July 9, 2023, 6:33 p.m.

Related to dmvnorm in emdbook...