[R] Problem implementing adapt()

2007-11-04 Thread Sergey Goriatchev
that's the bvnpdf() code: bvnpdf <- function(xy, mu, Siginv, detSig){ f<-numeric() x <- xy[[1]] if(xy[[1]]>xy[[2]] & (1==2)) { f <- 0} else { v <- rbind(xy[1], xy[2]) e <- t(v-mu) %*% Siginv %*% (v-mu) f <- as.numeric(

[R] Problem implementing adapt()

2007-11-04 Thread Sergey Goriatchev
Hello, I am trying to compute rectangle probability of bivariate normal distribution with the following function: bvnrectangle <- function(mu, Sig, xmin, xmax, ymin, ymax){ library(adapt) Siginv <- solve(Sig) detSig <- det(Sig) areal <- adapt(ndim=2, lower=c(xmin,ymin), upper=c(xmax,ymax), minpts=