pgamma.deriv {VGAM} | R Documentation

## 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).

### 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) = 1/Gamma(a) integral_0^x t^(a-1) exp(-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 <= x <= 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.

### 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).

### Note

If convergence does not occur then try increasing the value of `tmax`.

Yet to do: add more arguments to give greater flexibility in the accuracy desired and to compute only quantities that are required by the user.

### Author(s)

T. W. Yee wrote the wrapper function to the Fortran subroutine written by R. J. Moore. The subroutine was modified to run using double precision. The original code came from `http://lib.stat.cmu.edu/apstat/187`. but this website has since become stale.

### 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

    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 = "")
    ## End(Not run)

[Package VGAM version 1.0-4 Index]