Displaying 1 result from an estimated 1 matches for "pbeta2".
Did you mean:
beta2
2005 Oct 31
3
Applying a function to a vector
...or a single value, but I want to apply it to a vector
of 22 000 values. I can use a loop for the calculation
of each value but it runs very very slowly.
So, what can I change ?
Hers's the function :
p <- c(1,1)
y <- 1
z <- 1
truc <- function(y) {y^(p[1]-1)/(1+y)^(p[1]+p[2])}
pbeta2 <- function(z,p)
1/beta(p[1],p[2])*integrate(truc,0,z)$value
machin <- pbeta2(vector,p) just return a single value
Thanks for your help