[R] Strange results from Multivariate Normal Density

Ravi Varadhan rvaradhan at jhmi.edu
Mon Apr 12 18:18:30 CEST 2010


It does make sense because your variance-covariance matrix is NOT
positive-definite.  So, it cannot be a variance-covariance matrix.  

Ravi.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Downey, Patrick
Sent: Monday, April 12, 2010 11:57 AM
To: R help
Subject: [R] Strange results from Multivariate Normal Density

Hello,

I'm using dmnorm from the package {mnormt} and getting strange results.

First, according to the documentation, dmnorm should return a vector of
densities, and I'm only getting one value returned (which is what I would
expect). I've been interpreting this as the joint density of all values in
the x vector (which is what I want). Should a vector of densities be
returned, and if so, to what do they correspond?

Second, and far more concerning, when I enter the following:

varcov1 <- array(0,dim=c(2,2))
  varcov1[1,1] <- 0.4891125
  varcov1[2,2] <- 0.4891125
  varcov1[1,2] <- 0.5
  varcov1[2,1] <- 0.5
varcov1
dmnorm(c(0.930315,-0.8706811),mean=c(1.109568,6.648583),varcov1)

The result is an infinite density, which seems unlikely. For instance, the
second value is more than 7 standard deviations from the mean.

Thanks in advance for any comments and suggestions.

-Mitch

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list