### Function Reference: `gampdf`

statistics: y = gampdf (x, a, b)

Gamma probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the Gamma distribution with shape parameter a and scale parameter b. The size of y is the common size of x, 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, gaminv, gamrnd, gamfit, gamlike, gamstat

Source Code: gampdf

### Example: 1

     ## Plot various PDFs from the Gamma distribution
     x = 0:0.01:20;
     y1 = gampdf (x, 1, 2);
     y2 = gampdf (x, 2, 2);
     y3 = gampdf (x, 3, 2);
     y4 = gampdf (x, 5, 1);
     y5 = gampdf (x, 9, 0.5);
     y6 = gampdf (x, 7.5, 1);
     y7 = gampdf (x, 0.5, 1);
     plot (x, y1, "-r", x, y2, "-g", x, y3, "-y", x, y4, "-m", ...
           x, y5, "-k", x, y6, "-b", x, y7, "-c")
     grid on
     ylim ([0,0.5])
     legend ({"α = 1, β = 2", "α = 2, β = 2", "α = 3, β = 2", ...
              "α = 5, β = 1", "α = 9, β = 0.5", "α = 7.5, β = 1", ...
              "α = 0.5, β = 1"}, "location", "northeast")
     title ("Gamma PDF")
     xlabel ("values in x")
     ylabel ("density")