[R] two-dimensional integration?

Nils-at-Duke Lid Hjort hjort at isds.duke.edu
Thu Mar 10 06:22:25 CET 2005

I find the one-dimensional "integrate" very helpful,
but often enough I stumble into problems that require
two (or more)-dimensional integrals. I suppose there
are no R functions that can do this for me, "directly"?

The ideal thing would be to be able to define say
f <- function(x)
x1 <- x[1]
x2 <- x[2]
and then write say
integrate(f, xlim=c(0,1), ylim=c(0,1))  .

(a) No such thing exists, as of today, right?
(b) There *are* general numerical routines "out there"
for doing such things, right? (Importance sampling
or adaptive important sampling would often do the
job, but it would be difficult to find something that
"always" works -- at least in higher dimension?
Also, iterated one-dimensional integrations could
be attempted, but I find that messy, also because
things lose the g(many) = many(g) property, and
then R refuses to integrate g.)
(c) Will a thing like the above exist in R before
the Tromsoe Olympics in 2014? For which dimensions? 

Nils Lid Hjort
[Professor of statistics at Oslo, but currently at Duke]

More information about the R-help mailing list