distribution - R function pmvnorm: Why do values and errors differ every time I run this function with the same inputs? -
In my understanding, the pmvnorm multivariate in the mvtnorm library is a function to calculate CDF on general distribution. So this is a determining function. However, I found that the result every time I run this function with the same input. Here is a small example.
Library (mvtnorm) below & lt; - c (-Inf, -0.07, 0.81, -Inf, 0.8 9, -Inf, 1.33, 1.21, -inf) Upper & lt; - c (1.00, 0.34, 0.98, -0.04, 1.07, 0.01, 1.48, 1.38, 0.09) Sigma & lt; - Matrix (C (0.03, 0.00, -0.01, 0.00, 0.00, 0.00, 0.00, 0.02, 0.00, 1.00, 0.66, 0.64, 0.64, 0.64, 0.64, 0.64, 0.64, -0.01, 0.66, 0.99, 0.66, 0.64, 0.64, 0.64, 0.64, 0.64, 0.00, 0.64, 0.66, 1.00, 0.66, 0.64, 0.64, 0.64, 0.64, 0.00, 0.64, 0.64, 0.66, 1.00, 0.66, 0.64, 0.64, 0.64, 0.00, 0.64, 0.64, 0.64, 0.66, 1.00, 0.66, 0.64, 0.64, 0.00, 0.64, 0.64, 0.64, 0.64, 0.66, 1.00, 0.66, 0.64, 0.00, 0.64, 0.64, 0.64, 0.64, 0.64, 0.66, 1.00, 0.66, 0.02, 0.64, 0.64, 0.64, 0.64, 0.64, 0.64, 0.66, 1.00), bio = TRUE, length (lower)) set.seed (1) (try1 & lt; - pmvnorm (lower = lower, upper = Upper, sigma = sigma)) It values me: 4.42436e-09 etter (, "error") [1] 4.31215 9-13 etter (, "msg") [ 1] "general closing"
I now re-evaluate with the function I am a different seed.
set.seed (2) (try2 <- pmvnorm (lower = lower, upper = upper, sigma = sigma))
and
try1 == try2 gives me:
[1] FALSE Is it possible to understand why this is happening?
? See the first reference given in Pmvnorm . For example, in a nutshell, pmvnorm use a Monte Carlo sample algorithm to calculate the distribution function of multivariate normal distribution.
Comments
Post a Comment