Learn R Programming

VGAM (version 1.1-6)

pgamma.deriv: Derivatives of the Incomplete Gamma Integral

Description

The first two derivatives of the incomplete gamma integral.

Usage

pgamma.deriv(q, shape, tmax = 100)

Arguments

q, shape

As in pgamma but these must be vectors of positive values only and finite.

tmax

Maximum number of iterations allowed in the computation (per q value).

Value

The first 5 columns, running from left to right, are the derivatives with respect to: \(x\), \(x^2\), \(a\), \(a^2\), \(xa\). The 6th column is \(P(a, x)\) (but it is not as accurate as calling pgamma directly).

Details

Write \(x = q\) and shape = \(a\). The first and second derivatives with respect to \(q\) and \(a\) are returned. This function is similar in spirit to pgamma; define $$P(a,x) = \frac{1}{\Gamma(a)} \int_0^x t^{a-1} e^{-t} dt$$ so that \(P(a, x)\) is pgamma(x, a). Currently a 6-column matrix is returned (in the future this may change and an argument may be supplied so that only what is required by the user is computed.)

The computations use a series expansion for \(a \leq x \leq 1\) or or \(x < a\), else otherwise a continued fraction expansion. Machine overflow can occur for large values of \(x\) when \(x\) is much greater than \(a\).

References

Moore, R. J. (1982). Algorithm AS 187: Derivatives of the Incomplete Gamma Integral. Journal of the Royal Statistical Society, Series C (Applied Statistics), 31(3), 330--335.

See Also

pgamma.deriv.unscaled, pgamma.

Examples

Run this code
# NOT RUN {
x <- seq(2, 10, length = 501)
head(ans <- pgamma.deriv(x, 2))
# }
# NOT RUN {
 par(mfrow = c(2, 3))
for (jay in 1:6)
  plot(x, ans[, jay], type = "l", col = "blue", cex.lab = 1.5,
       cex.axis = 1.5, las = 1, log = "x",
       main = colnames(ans)[jay], xlab = "q", ylab = "") 
# }

Run the code above in your browser using DataLab