Skip to content
Prev 157618 / 398506 Next

R's integrate function

What verson of R?

Works for me:
+   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
R version 2.7.2 (2008-08-25)
i386-apple-darwin8.11.1

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
HTH,

Chuck
On Tue, 30 Sep 2008, Susanne Pfeifer wrote:

            
Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901