[R] R's integrate function

Susanne Pfeifer tiffy at tiffy.it
Tue Sep 30 22:16:46 CEST 2008


Hi Charles,
hi Victor

Charles C. Berry schrieb:
> What verson of R?
> 
> Works for me:
> 
>> integrate(function(y,z){
> +   sapply(y, function(y,z){
> + integrate(function(x,z)
> +          
> 1/x*dbeta(0.01,x/(0.005/1.005),(1-x)/(0.005/1.005))*dbeta(y,x/(0.005/1.005),(1-x)/(0.005/1.005))*(1-y)^z,0,1
> 
> +           ,423)$value
> + })
> + },0,1,423)
> 18.9513 with absolute error < 0.0011

I have updated my version to the 2.7.2 and it works fine.
Thank you for the hint.
If I increase my constant now from 423 to 11,000, it still works fine
(producing a value of 8.226982) but if I increase it further (say to
12,000), R doesn't seem to calculate it right (resulting in
3.871566e-05) even if I increase the number of subdivisions.
Do you have any idea, why?

Thanks for your help again,
Tiffy



More information about the R-help mailing list