Yes, Albyn.  I do not think that this is a dangerous behavior of the tool
(`integrate').  It is certainly a "dangerous use" of the tool.  One will be
hard-pressed to find a numerical algorithm/software that is fool-proof in
the sense that it always gives you either the correct results or warns you
that the results could be wrong for your problem.  We can always devise a
problem to defeat even the most robust algorithm.  So, I would argue that
the ultimate responsibility lies with the user, via careful thinking/prior
analysis/ and multiple types of checks, to ensure that the results are
reasonably accurate.  

This, of course, does not mean that `integrate' gets away scot free.  I am
sure it could be improved, but I am also quite certain that there are better
quadrature algorithms.  So, one needs to choose appropriate algorithms to
suit their problem needs.  Perhaps, the simplest thing to do for `integrate'
might be to print a generic warning like:  "The error estimate is not always
reliable".  Of course, this does not help the user since they would not know
when it is NOT reliable. The next thing to try might be to examine how it
picks the initial interval [0, x], and see if this procedure can be
improved.  

Best,
Ravi.

-------------------------------------------------------
Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology School of Medicine Johns
Hopkins University

Ph. (410) 502-2619
email: rvarad...@jhmi.edu


-----Original Message-----
From: Albyn Jones [mailto:jo...@reed.edu] 
Sent: Thursday, December 02, 2010 6:41 PM
To: Ravi Varadhan
Cc: 'Hans W Borchers'; r-help@r-project.org
Subject: Re: [R] Integral of PDF

On Thu, Dec 02, 2010 at 06:23:45PM -0500, Ravi Varadhan wrote:

> A simple solution is to locate the mode of the integrand, which should be
> quite easy to do, and then do a coordinate shift to that point and then
> integrate the mean-shifted integrand using `integrate'.
> 
> Ravi.

Translation:  think before you compute!

albyn

______________________________________________
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.

Reply via email to