dmvnorm | R Documentation |
Calculates the probability density function of the multivariate normal distribution
dmvnorm(x, mu, Sigma, log = FALSE, tol = 1e-06)
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 |
uses naive linear algebra – could probably use QR decomposition and/or crossprod.
vector of log-likelihoods
Ben Bolker
mvrnorm
(in MASS
package),
dmvnorm
(in mvtnorm
package)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.