The result is different when using a variance matrix and a correlation matrix. Why is this happening?
I will write down the results directly for convenience.
Variance matrix - naming as co
0.1234 0.125
0.1250 0.245
Correlation matrix - naming as coo (made by cov2cor function)
1.0000 0.7189
0.7189 1.0000
Result
pmvnorm(mean=c(1,1),sigma=co, lower=rep(-Inf,2), upper=c(0.7,4)
0.1965493
pmvnorm(mean=c(1,1),corr=coo, lower=rep(-Inf,2), upper=c(0.7,4)
0.3820885
I made a covariance matrix, and we got a correlation matrix using covariance matrix. And these two values were implemented, and the result was different.
It is code.
install.packages("mvtnorm")
library(mvtnorm)
co <- matrix(c(0.1234,0.125,0.125,0.245),2,2)
coo <- cov2cor(co)
pmvnorm(mean=c(1,1),sigma=co, lower=rep(-Inf,2), upper=c(0.7,4)
pmvnorm(mean=c(1,1),corr=coo, lower=rep(-Inf,2), upper=c(0.7,4)
Please let me know why.