Hello all,
I'm hoping to find a way to evaluate the following sort of integral in R.
\int_a^b \int_{g(y)}^Inf f(x,y) dx dy.
The integral has no closed form and so must be evaluated numerically. The
"adapt" package provides
for multidimensional integration but does not appear to allow the limits of
integration to be a
function. I need to evaluate a number of integrals of this sort and I need the
evaluations to be
fairly precise (something like 10^-6 or 10^-7 would be sufficient) so I'd
prefer to avoid
time-consuming MCMC methods.
Any ideas?
Thanks,
Chris Rhoads
I have used the functions in the statmod package regularly to evaluate complex integrals using gaussian quadrature.> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of Chris Rhoads > Sent: Tuesday, October 23, 2007 4:58 PM > To: r-help at r-project.org > Subject: [R] 2-D numerical integration over odd region > > Hello all, > > I'm hoping to find a way to evaluate the following sort of > integral in R. > > \int_a^b \int_{g(y)}^Inf f(x,y) dx dy. > > The integral has no closed form and so must be evaluated > numerically. The "adapt" package provides for > multidimensional integration but does not appear to allow the > limits of integration to be a function. I need to evaluate a > number of integrals of this sort and I need the evaluations > to be fairly precise (something like 10^-6 or 10^-7 would be > sufficient) so I'd prefer to avoid time-consuming MCMC methods. > > Any ideas? > > Thanks, > > Chris Rhoads > > ______________________________________________ > R-help at 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. >
Frede Aakmann Tøgersen
2007-Oct-24 06:47 UTC
[R] 2-D numerical integration over odd region
Well if you define
F(x,y) = I_{x > g(y)} f(x,y),
where I is an indicator function giving a 0 if x < g(y) and a 1 of x >
g(y) then
\int_a^b \int_{g(y)}^Inf f(x,y) dx dy = \int_a^b \int_{-Inf}^Inf F(x,y) dx dy
There are several things you can do to make the integrals easier to be
evaluated. The first thing I would is to make a substitution in x to map the
interval (-Inf, Inf) to e.g. (0, 1). Then you only need to integrate over (0,1)
in the inner integral. I think you can read about that in Abramowitz, Milton and
Stegun, Irene A. (Eds.). Handbook of Mathematical Functions with Formulas,
Graphs, and Mathematical Tables ( or is it Gradshteyn, I.S. and Ryzhik, I.M.
Tables of Integrals, Series, and Products??). Perhaps you or other can provide
other references.
Med venlig hilsen
Frede Aakmann T?gersen
> -----Oprindelig meddelelse-----
> Fra: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] P? vegne af Chris Rhoads
> Sendt: 23. oktober 2007 22:58
> Til: r-help at r-project.org
> Emne: [R] 2-D numerical integration over odd region
>
> Hello all,
>
> I'm hoping to find a way to evaluate the following sort of
> integral in R.
>
> \int_a^b \int_{g(y)}^Inf f(x,y) dx dy.
>
> The integral has no closed form and so must be evaluated
> numerically. The "adapt" package provides for
> multidimensional integration but does not appear to allow the
> limits of integration to be a function. I need to evaluate a
> number of integrals of this sort and I need the evaluations
> to be fairly precise (something like 10^-6 or 10^-7 would be
> sufficient) so I'd prefer to avoid time-consuming MCMC methods.
>
> Any ideas?
>
> Thanks,
>
> Chris Rhoads
>
> ______________________________________________
> R-help at 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.
>