Skip to content
Prev 316948 / 398503 Next

integrate: Don't do this?

To answer my own question: I thought for a while that centering is the 
solution to the problem, but it is not:

 > integrate(dnorm, 0, Inf, mean = 25)
3.187474e-05 with absolute error < 5.9e-05
 > integrate(dnorm, -25, Inf, mean = 0)
3.187474e-05 with absolute error < 5.9e-05

Here "Don't do this" is the wrong advise. Better:

 > integrate(dnorm, -25, 10, mean = 0)
1 with absolute error < 1.5e-06

So, in my slightly more complicated example below,
the integration limits should be

max(0, nv - 10), nv + 10 (or so)

i.e., a finite interval of suitable length. Maybe the advice in the 
documentation about "integrating over infinite intervals" needs some 
modification?

G?ran
On 02/05/2013 07:42 PM, G?ran Brostr?m wrote: