Accelerating the pace of engineering and science

# gamcdf

Gamma cumulative distribution function

## Syntax

gamcdf(x,a,b)
[p,plo,pup] = gamcdf(x,a,b,pcov,alpha)
[p,plo,pup] = gamcdf(___,'upper')

## Description

gamcdf(x,a,b) returns the gamma cdf at each of the values in x using the corresponding shape parameters in a and scale parameters in b. x, a, and b can be vectors, matrices, or multidimensional arrays that all have the same size. A scalar input is expanded to a constant array with the same dimensions as the other inputs. The parameters in a and b must be positive.

[p,plo,pup] = gamcdf(x,a,b,pcov,alpha) produces confidence bounds for p when the input parameters a and b are estimates. pcov is a 2-by-2 matrix containing the covariance matrix of the estimated parameters. alpha has a default value of 0.05, and specifies 100(1-alpha)% confidence bounds. plo and pup are arrays of the same size as p containing the lower and upper confidence bounds.

[p,plo,pup] = gamcdf(___,'upper') returns the complement of the gamma cdf at each value in x, using an algorithm that more accurately computes the extreme upper tail probabilities. You can use the 'upper' argument with any of the previous syntaxes.

The gamma cdf is

$p=F\left(x|a,b\right)=\frac{1}{{b}^{a}\Gamma \left(a\right)}\underset{0}{\overset{x}{\int }}{t}^{a-1}{e}^{\frac{-t}{b}}dt$

The result, p, is the probability that a single observation from a gamma distribution with parameters a and b will fall in the interval [0 x].

gammainc is the gamma distribution with b fixed at 1.

## Examples

expand all

### Compute Gamma Distribution CDF

The mean of the gamma distribution is the product of the parameters, ab. In this example, the mean approaches the median as it increases (i.e., the distribution becomes more symmetric).

```a = 1:6;
b = 5:10;
prob = gamcdf(a.*b,a,b)```
```prob =
0.6321  0.5940  0.5768  0.5665  0.5595  0.5543```