[R] performance of adaptIntegrate vs. integrate
baptiste.auguie at googlemail.com
Fri Nov 11 22:50:39 CET 2011
Thank you for your answer.
The integrand I proposed was a dummy example for demonstration
purposes. I experienced a similar slowdown in a real problem, where
knowing in advance the shape of the integrand would not be so easy.
Your advice is sound; I would have to study the underlying code of the
two implementations to know where the difference lies. Delving into
the source code and the algorithms gets quite technical though, so I
was hoping someone already familiar with integrate's internals might
shed some light.
On 12 November 2011 03:55, Ravi Varadhan <rvaradhan at jhmi.edu> wrote:
> The integrand is highly peaked. It is approximately an impulse function
> where much of the mass is concentrated at a very small interval. Plot the
> function and see for yourself. This is the likely cause of the problem.
> Other types of integrands where you could experience problems are:
> integrands with singularity at either limit and slowly decaying oscillatory
> integrands. As to why integrate performs better than adaptIntegrate in this
> situation, I don’t know. You have to study the two implementations.
> Wynn’s epsilon algorithm is an extrapolation method for improving the
> convergence of a sequence. This could be an explanation for the better
> performance, but I cannot say for sure.
> Hope this is helpful,
> Ravi Varadhan, Ph.D.
> Assistant Professor,
> Division of Geriatric Medicine and Gerontology School of Medicine Johns
> Hopkins University
> Ph. (410) 502-2619
> email: rvaradhan at jhmi.edu
More information about the R-help