gammainc {expint} | R Documentation |
Incomplete Gamma Function
Description
The incomplete gamma function .
Usage
gammainc(a, x)
Arguments
a |
vector of real numbers. |
x |
vector of non-negative real numbers. |
Details
As defined in 6.5.3 of Abramowitz and Stegun (1972), the incomplete gamma function is
for real and
.
For non-negative values of , we have
where is the function implemented
by R's
gamma()
and is the
cumulative distribution function of the gamma distribution (with scale
equal to one) implemented by R's
pgamma()
.
Also, ,
,
where
is the exponential integral implemented in
expint
.
Value
The value of the incomplete gamma function.
Invalid arguments will result in return value NaN
, with a warning.
Note
The C implementation is based on code from the GNU Software Library https://www.gnu.org/software/gsl/.
Author(s)
Vincent Goulet vincent.goulet@act.ulaval.ca
References
Abramowitz, M. and Stegun, I. A. (1972), Handbook of Mathematical Functions, Dover.
See Also
Examples
## a > 0
x <- c(0.2, 2.5, 5, 8, 10)
a <- 1.2
gammainc(a, x)
gamma(a) * pgamma(x, a, 1, lower = FALSE) # same
## a = 0
a <- 0
gammainc(a, x)
expint(x) # same
## a < 0
a <- c(-0.25, -1.2, -2)
sapply(a, gammainc, x = x)