hello, I'm trying to improve the speed of my calculation but didn't get to a satisfying result.
It's about the numerical Integration of a bivariate normal distribution. The code I'm currently using x <- qnorm(seq(.Machine$double.xmin,c(1-2*.Machine$double.eps),by=0.01), mean=0,sd=1) rho <- 0.5 integral <- function(rho,x1){ m1 <- length(x1)-1 integral <- matrix(0,ncol=m1,nrow=m1) for (i in c(1:m1)){ for (j in c(1:m1)){ integral[i,j] <- pmvnorm(lower=c(x1[i],x1[j]), upper=c( x1[c(i+1)], x1[c(j+1)]), corr=matrix(c(1,rho,rho,1),ncol=2)) } } return(integral)} integral(rho,x) I need all these values separated as in my calculation, but currently it's much too slow... Has anyone an idea how to improve it? Thanks Juliane -- View this message in context: http://r.789695.n4.nabble.com/Bivariate-normal-integral-tp4571018p4571018.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.