[R] Integration in R
Rolf Turner
rolf.turner at xtra.co.nz
Wed Nov 21 21:57:03 CET 2012
On 21/11/12 22:26, Rehena Sultana wrote:
> Dear R - Experts,
>
> I am trying to integrate lognormal distribution (mu = -0.3 and sigma2 = 0.00041.. ) based on the some hypothetical data. But I am getting 0 as the result. I have checked that my R-code is correct as code is giving me result for some other data.
>
> As I understand, when I am integrating some pdf with in the range of (0, Inf), I should not get 0. How to handle this kind of problem?
>
> Please help. Looking forward for your reply.
Reproducible example?
When I do
integrate(function(x){dlnorm(x,meanlog=-0.3,sdlog=sqrt(0.00041))},0,Inf)
I get
1 with absolute error < 3.5e-06
No problema.
Why do you want to integrate it anyhow? You know the answer is 1.
Or if you want the integral from 0 to x for some x < infinity, just use
plnorm(). (???)
cheers,
Rolf Turner
More information about the R-help
mailing list