Categories &

Functions List

Function Reference: gaminv

statistics: x = gaminv (p, a, b)

Inverse of the Gamma cumulative distribution function (iCDF).

For each element of p, compute the quantile (the inverse of the CDF) of the Gamma distribution with shape parameter a and scale parameter b. The size of x is the common size of p, a, and b. A scalar input functions as a constant matrix of the same size as the other inputs.

OCTAVE/MATLAB use the alternative parameterization given by the pair α, β, i.e. shape a and scale b. In Wikipedia, the two common parameterizations use the pairs k, θ, as shape and scale, and α, β, as shape and rate, respectively. The parameter names a and b used here (for MATLAB compatibility) correspond to the parameter notation k, θ instead of the α, β as reported in Wikipedia.

Further information about the Gamma distribution can be found at https://en.wikipedia.org/wiki/Gamma_distribution

See also: gamcdf, gampdf, gamrnd, gamfit, gamlike, gamstat

Source Code: gaminv

Example: 1

 

 ## Plot various iCDFs from the Gamma distribution
 p = 0.001:0.001:0.999;
 x1 = gaminv (p, 1, 2);
 x2 = gaminv (p, 2, 2);
 x3 = gaminv (p, 3, 2);
 x4 = gaminv (p, 5, 1);
 x5 = gaminv (p, 9, 0.5);
 x6 = gaminv (p, 7.5, 1);
 x7 = gaminv (p, 0.5, 1);
 plot (p, x1, "-r", p, x2, "-g", p, x3, "-y", p, x4, "-m", ...
       p, x5, "-k", p, x6, "-b", p, x7, "-c")
 ylim ([0, 20])
 grid on
 legend ({"α = 1, β = 2", "α = 2, β = 2", "α = 3, β = 2", ...
          "α = 5, β = 1", "α = 9, β = 0.5", "α = 7.5, β = 1", ...
          "α = 0.5, β = 1"}, "location", "northwest")
 title ("Gamma iCDF")
 xlabel ("probability")
 ylabel ("x")

                    
plotted figure