Function Reference: gaminv

statistics: x = gaminv (p, k, theta)

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 k and scale parameter theta. The size of x is the common size of p, k, and theta. A scalar input functions as a constant matrix of the same size as the other inputs.

There are two equivalent parameterizations in common use:

  1. With a shape parameter k and a scale parameter θ, which is used by gaminv.
  2. With a shape parameter α = k and an inverse scale parameter β = 1 / θ, called a rate parameter.

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