Gamma inverse cumulative distribution function


X = gaminv(P,A,B)
[X,XLO,XUP] = gaminv(P,A,B,pcov,alpha)


X = gaminv(P,A,B) computes the inverse of the gamma cdf with shape parameters in A and scale parameters in B for the corresponding probabilities in P. P, 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 all be positive, and the values in P must lie on the interval [0 1].

The gamma inverse function in terms of the gamma cdf is




[X,XLO,XUP] = gaminv(P,A,B,pcov,alpha) produces confidence bounds for X 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. XLO and XUP are arrays of the same size as X containing the lower and upper confidence bounds.


This example shows the relationship between the gamma cdf and its inverse function.

a = 1:5;
b = 6:10;
x = gaminv(gamcdf(1:5,a,b),a,b)
x =
  1.0000  2.0000  3.0000  4.0000  5.0000


There is no known analytical solution to the integral equation above. gaminv uses an iterative approach (Newton's method) to converge on the solution.

Extended Capabilities

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

Introduced before R2006a