Gammadf
Purpose
Gamma distribution.
Synopsis
- prob = gammadf(function,x,a,b)
Description
Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Gamma distribution.
This distribution is commonly used to measure lifetime data (like the exponential distribution). The variance may be smaller, equal, or larger than the mean for this distribution and may also be symmetric or asymmetric. Negative values in the sample are ignored.
Inputs
- function = [ {'cumulative'} | 'density' | 'quantile' | 'random' ], defines the functionality to be used. Note that the function recognizes the first letter of each string so that the string could be: [ 'c' | 'd' | 'q' | 'r' ].
- x = matrix in which the sample data is stored, in the interval (0,inf).
- for function=quantile - matrix with values in the interval (0,1).
- for function=random - vector indicating the size of the random matrix to create.
- a = scale parameter (real and nonnegative).
- b = shape parameter (real and nonnegative).
Note: If inputs (x, a, and b) are not equal in size, the function will attempt to resize all inputs to the largest input using the RESIZE function.
Note: Functions will typically allow input values outside of the acceptable range to be passed but such values will return NaN in the results.
Examples
Cumulative
>> prob = gammadf('c',0.99,0.5) prob = 0.8406 >> x = [0:0.1:10]; >> plot(x,gammadf('c',x,2),'b-',x,gammadf('c',x,0.5),'r-')
Density
>> prob = gammadf('d',0.99,0.5) prob = 0.2107 >> x = [0:0.1:10]; >> plot(x,gammadf('d',x,2),'b-',x,gammadf('d',x,0.5),'r-')
Quantile
>> prob = gammadf('q',0.99,0.5) prob = 3.3174
Random
>> prob = gammadf('r',[4 1],2) ans = 0.4549 0.4638 0.3426 0.5011
See Also
betadf, cauchydf, chidf, expdf, gumbeldf, laplacedf, logisdf, lognormdf, normdf, paretodf, raydf, triangledf, unifdf, weibulldf