[R] Strange results from Multivariate Normal Density
Downey, Patrick
PDowney at urban.org
Mon Apr 12 17:56:45 CEST 2010
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
More information about the R-help
mailing list