You got the point. Thank you for pointing out the problem.

Thanks again.
David


2013/8/30 Duncan Murdoch <murdoch.dun...@gmail.com>

> On 29/08/2013 1:37 PM, Marino David wrote:
>
>> Hi all R users:
>>
>>
>>
>> I am a little bit confused about the following results. See as follows:
>>
>>
>>
>> library(mvtnorm)
>>
>>
>>
>> xMean<-c(24.12,66.92,77.65,**131.97,158.8)
>>
>> xVar<-c(0.01,0.06,0.32,0.18,0.**95)
>>
>> xFloor<-floor(xMean)
>>
>>
>>
>> # use “mvtnorm” package
>>
>> p1<-dmvnorm(xFloor,mean=xMean,**sigma=diag(xVar))
>>
>> p2<-dmvnorm(xFloor[1],mean=**xMean[1],sigma=matrix(xVar[1])**
>> )*dmvnorm(xFloor[2],mean=**xMean[2],sigma=matrix(xVar[2])**
>> )*dmvnorm(xFloor[3],mean=**xMean[3],sigma=matrix(xVar[3])**)
>>
>>
>>
>> # use the basic package “stats”
>>
>> p3<-dnorm(xFloor[1],mean=**xMean[1],sd=sqrt(xVar[1]))***
>> dnorm(xFloor[2],mean=xMean[2],**sd=sqrt(xVar[2]))*dnorm(**
>> xFloor[3],mean=xMean[3],sd=**sqrt(xVar[3]))
>>
>>
>>
>> The result is: p1= 2.006403e-05, p2=p3= 0.00099646. My question is why p1
>> does not equal to p2 when the covariance matrix is diagonal, meaning no
>> correlation among variates. From p2=p3, it seems that the “mvtnorm”
>> package
>> exhibits well agreement with the R basic package. Any explain will be
>> greatly appreciated.
>>
>>
> Why would you expect p1=p2? p1 is the density in 5 dimensions, p2 is only
> the first 3 components.
>
> Duncan Murdoch
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to