Displaying 2 results from an estimated 2 matches for "cumdensity".
Did you mean:
cpgdensity
2012 Mar 15
2
Integrate inside function
...ate2
prev=prev
fun<-prev*((rate1^shape1)/gamma(shape1)*(x^(shape1-1))*exp(-rate1*x))
+ (1-prev)*((rate2^shape2)/gamma(shape2)*(x^(shape2-1))*exp(-rate2*x))
return(fun)
}
den<-density.function(y)
p.mixedgamma<-integrate(f=density.function,lower=0,upper=y)
return(list(density=den,cumdensity=p.mixedgamma$value))
}
Why doesn't this calculate cumdensity (p.mixedgamma) in case x is a vector?
For instance try:
pmixedgamma3(c(10,20),shape1=10,rate1=1,shape2=10,rate2=1,prev=0.5)
As you can see cumdensity is calculated just for the first x value.
Thanks in advance
Best
Mauro
--
Mau...
2010 Feb 10
1
looping problem
Hi R-users,
I have this code here:
library(numDeriv)
fprime <- function(z)
{ alp <- 2.0165;
rho <- 0.868;
# simplified expressions
a <- alp-0.5
c1 <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)
c2 <- sqrt(rho)/(1-rho)
t1 <- exp(-z/(1-rho))
t2 <- (z/(2*c2))^a
bes1 <- besselI(z*c2,a)
t1bes1 <- t1*bes1
c1*t1bes1*t2
}
## Newton