Gamma cumulative distribution function


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


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, and the values in x must lie on the interval [0 Inf].

[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


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.


collapse all

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 = 1×6

    0.6321    0.5940    0.5768    0.5665    0.5595    0.5543

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Introduced before R2006a