I'm trying to integrate one dimension of a bivariate normal. It works when additional parameters are passed explicitly:
library(mvtnorm) bivInt <- function(x,y,mx,my,r) { dmvnorm(c(x, y), mean=c(mx, my), sigma=rbind(c(1, r), c(r, 1))) } integrate(Vectorize(bivInt), lower=-Inf, upper=2, 1, 2, 2, .5)$value # [1] 0.1737709 How to make it work when the additional parameters are passed as variables? I'm getting errors: y<-1; mx<-2; my<-2; r<-.5 integrate(Vectorize(bivInt), lower=-Inf, upper=2, y, mx, my, r) # Error in eval(expr, envir, enclos) : # ..1 used in an incorrect context, no ... to look in > integrate(Vectorize(bivInt), lower=-Inf, upper=2, y=y, mx=mx, my=my, r=r) Error in eval(expr, envir, enclos) : ..1 used in an incorrect context, no ... to look in ______________________________________________ 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.