[R] infinity in integrate function in R
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Tue Nov 7 23:05:42 CET 2000
On Tue, 7 Nov 2000, Thomas Lumley wrote:
> On Tue, 7 Nov 2000 eloi_kpamegan at hgsi.com wrote:
> > The integrate function in R is not taking Inf (infinity). How do you use
> > infinity in R. I was doing: integrate(dnorm, Inf, 1.96) and I was getting
> > Error: NA/NaN/Inf in foreign function call (arg 2). Obviously this should
> > be equal to pnorm(1.96)= 0.9750021. How do you get around the infinity
> > problem in R?
> The integrate function doesn't know how to integrate over infinite
> regions. This is a different (and more difficult) problem than integrating
> over finite regions.
But it does know how to do integrate(dnorm, 10, 1.96) and in this problem
we have an accurate estimate of the tail probabilities that shows that is
You can also transform the range to (-1,1), say. (Or, of course, use
With a modicum of numerical analysis, this really is not a problem.
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help