gammainc | R Documentation |
The incomplete gamma function G(a, x).
gammainc(a, x)
a |
vector of real numbers. |
x |
vector of non-negative real numbers. |
As defined in 6.5.3 of Abramowitz and Stegun (1972), the incomplete gamma function is
G(a, x) = int_x^Inf t^(a - 1) exp(-t) dt
for a real and x ≥ 0.
For non-negative values of a, we have
G(a, x) = Gamma(a) (1 - P(a, x)),
where Gamma(a) is the function implemented
by R's gamma()
and P(a, x) is the
cumulative distribution function of the gamma distribution (with scale
equal to one) implemented by R's pgamma()
.
Also, G(0, x) = E_1(x), x > 0,
where E_1(x) is the exponential integral implemented in
expint
.
The value of the incomplete gamma function.
Invalid arguments will result in return value NaN
, with a warning.
The C implementation is based on code from the GNU Software Library https://www.gnu.org/software/gsl/.
Vincent Goulet vincent.goulet@act.ulaval.ca
Abramowitz, M. and Stegun, I. A. (1972), Handbook of Mathematical Functions, Dover.
expint
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.