Re: [R] Regularized gamma function/ incomplete gamma function

2009-12-13 Thread Stefan Evert
Indeed, it seems that the author of zipfR has neither been aware that the (scaled / aka regularized) incomplete gamma (and beta, for that matter!) functions have been part of R all along. ... ... well , inspecting his code reveals he did know it. But why then on earth provide all the n

Re: [R] Regularized gamma function/ incomplete gamma function

2009-12-12 Thread Martin Maechler
RV> I would be very grateful if you could help me with: RV> Given the regularized gamma function Reg=int_0^r RV> (x^(k-1)e^(-x))dx/int_0^Inf (x^(k-1)e^(-x))dx ; 0 (which is eventually the ratio of the Incomplete gamma RV> function by the gamma function), and which is exactly what

Re: [R] Regularized gamma function/ incomplete gamma function

2009-12-11 Thread Ravi Varadhan
You can do this using the package "numDeriv". require(zipfR) require(numDeriv) fn <- function(x, y) Rgamma.inv(x, y) gRgamma.inv <- function(y, k) sapply(y, function(y) grad(x=k, func=fn, y=y)) plot(gRgamma.inv(y=seq(0,1, length=200), k=1), type="l", xlab="x", ylab="Derivative of Rgamma.inv w

Re: [R] Regularized gamma function/ incomplete gamma function

2009-12-11 Thread Stefan Evert
I would be very grateful if you could help me with: Given the regularized gamma function Reg=int_0^r (x^(k-1)e^(-x))dx/ int_0^Inf (x^(k-1)e^(-x))dx ; 0of the Incomplete gamma function by the gamma function), does anyone know of a package in R that would evaluate the derivative of the inverse