Gammadf: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
 
imported>Bob
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
===Purpose===
===Purpose===
Gamma distribution.
Gamma distribution.
===Synopsis===
===Synopsis===
:prob = gammadf(function,x,a,b)
:prob = gammadf(function,x,a,b)
===Description===
===Description===
Estimates cumulative distribution function (cumulative, cdf), probability density function (density, pdf), quantile (inverse of cdf), or random numbers for a Gamma distribution.  
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.
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:
::<math>f(x) = \frac {\left (x/a \right )^{b-1} \exp \left ( -x/a \right )} {a \Gamma \left ( b \right )}</math>
* 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).
====Inputs====
for function=random - vector indicating the size of the random matrix to create.
 
* a = scale parameter (real and nonnegative).
* '''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' ].
*  b = shape parameter (real and nonnegative).
 
* '''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''': 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.  
 
'''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===
===Examples===
====Cumulative:====
 
====Cumulative====
<pre>
>> prob = gammadf('c',0.99,0.5)
>> prob = gammadf('c',0.99,0.5)
prob =
prob =
Line 23: Line 42:
>> x    = [0:0.1:10];
>> x    = [0:0.1:10];
>> plot(x,gammadf('c',x,2),'b-',x,gammadf('c',x,0.5),'r-')
>> plot(x,gammadf('c',x,2),'b-',x,gammadf('c',x,0.5),'r-')
====Density:====
</pre>
====Density====
<pre>
>> prob = gammadf('d',0.99,0.5)
>> prob = gammadf('d',0.99,0.5)
prob =
prob =
Line 29: Line 50:
>> x    = [0:0.1:10];
>> x    = [0:0.1:10];
>> plot(x,gammadf('d',x,2),'b-',x,gammadf('d',x,0.5),'r-')
>> plot(x,gammadf('d',x,2),'b-',x,gammadf('d',x,0.5),'r-')
====Quantile:====
</pre>
====Quantile====
<pre>
>> prob = gammadf('q',0.99,0.5)
>> prob = gammadf('q',0.99,0.5)
prob =
prob =
     3.3174
     3.3174
====Random:====
</pre>
====Random====
<pre>
>> prob = gammadf('r',[4 1],2)
>> prob = gammadf('r',[4 1],2)
ans =
ans =
Line 40: Line 65:
     0.3426
     0.3426
     0.5011
     0.5011
</pre>
===See Also===
===See Also===
[[betadr]], [[cauchydf]], [[chidf]], [[expdf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[unifdf]], [[weibulldf]]
 
[[betadf]], [[cauchydf]], [[chidf]], [[expdf]], [[gumbeldf]], [[laplacedf]], [[logisdf]], [[lognormdf]], [[normdf]], [[paretodf]], [[raydf]], [[triangledf]], [[unifdf]], [[weibulldf]]

Latest revision as of 05:11, 10 October 2008

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