[R] numerical integration and 'non-finite function value' error

Ravi Varadhan rvaradhan at jhmi.edu
Thu Jun 23 04:42:35 CEST 2011


In the limit as x goes to infinity, the integrand x f(x) should go to 0 sufficiently fast in order for the integral to be finite.  The error indicates that the integrand becomes infinite for large x. Check to ensure that the integrand is correctly specified.

I don't understand how you can replace the upper limit of integration, Inf, by max f(x). This does not make much sense.

Can you produce a self-contained example? 

Ravi.
________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] on behalf of Adan_Seb [dmuluwork at gmail.com]
Sent: Wednesday, June 22, 2011 6:46 PM
To: r-help at r-project.org
Subject: [R] numerical integration and 'non-finite function value' error

Dear R users,

I have a question about numerical integration in R.
I am facing the 'non-finite function value' error while integrating the
function
                               xf(x)
using 'integrate'. f(x) is a probability density function and assumed to
follow the three parameter (min = 0) beta distribution for which I have
estimated the parameters. The function is integrated over two ranges, say
(0, a) and (a, Inf). The error 'non-finite function value' happens when I do
the integration for the second range. I have 10 different density functions
for 10 different data series and for some of them replacing Inf by the Max
of f(x) gives me an estimate of the area while for others this doesn't work.

What does the error mean and how can I address it? Is replacing a max for
Inf appropriate?

I really appreciate any clues.




--
View this message in context: http://r.789695.n4.nabble.com/numerical-integration-and-non-finite-function-value-error-tp3618486p3618486.html
Sent from the R help mailing list archive at Nabble.com.

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


More information about the R-help mailing list