Difference between revisions of "Gamma distribution"

Line 2: Line 2:
 
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
  
= Gamma(alpha'',beta'') =
+
== Gamma(alpha'', beta'') ==
  
Creates a gamma distribution with shape parameter alpha and scale
+
Creates a gamma distribution with shape parameter «alpha» and scale parameter «beta». The scale parameter, «beta», is optional and defaults to <code>beta = 1</code>. The gamma distribution is bounded below by zero (all sample points are positive) and is unbounded from above. It has a theoretical mean of <code>alpha*beta</code> and a theoretical variance of <code>alpha*beta^2</code>.
parameter beta. The scale parameter, beta, is optional and defaults to
 
beta=1. The gamma distribution is bounded below by zero (all sample
 
points are positive) and is unbounded from above. It has a
 
theoretical mean of A*B and a theoretical variance of alpha*beta^2.
 
When alpha>1, the distribution is unimodal with the mode at
 
(alpha-1)*beta. An exponential distribution results when alpha=1. As
 
alpha-->oo, the gamma distribution approaches a normal distribution
 
in shape.
 
  
The gamma distribution encodes the time required for alpha events to
+
When «alpha» > 1, the distribution is unimodal with the mode at <code>(alpha - 1)*beta</code>. An exponential distribution results when <code>alpha = 1</code>. As <math>\alpha \to \infty</math> , the gamma distribution approaches a normal distribution in shape.
occur in a Poisson process with mean arrival time of beta.
+
 
 +
The gamma distribution encodes the time required for «alpha» events to occur in a [[Poisson]] process with mean arrival time of «beta».
  
 
===Note===
 
===Note===
Some textbooks use Rate=1/beta, instead of beta, as the scale parameter.
+
Some textbooks use <code>Rate = 1/beta</code>, instead of «beta», as the scale parameter.
 +
 
 +
The probability density of the [[Gamma]] distribution is
  
The probability density of the Gamma distribution is
 
 
:<math>p(x) = {{\beta^{-\alpha} x^{\alpha-1} \exp(-x/\beta)}\over{\Gamma(\alpha)}}</math>
 
:<math>p(x) = {{\beta^{-\alpha} x^{\alpha-1} \exp(-x/\beta)}\over{\Gamma(\alpha)}}</math>
If you need to compute the density, use the <code>[[Dens_Gamma]](x,alpha,beta)</code> function from the <code>"Distribution Densities.ana"</code> library.  For the cumulative probability, use the <code>[[GammaI]](x,a,b)</code> function.
 
  
= When to use =
+
If you need to compute the density, use the [[Dens_Gamma]](x, alpha, beta) function from the <code>"Distribution Densities.ana"</code> library.  For the cumulative probability, use the [[GammaI]](x, a, b) function.
  
Use the gamma distribution with alpha>1 if you have a sharp lower
+
== When to use ==
bound of zero but no sharp upper bound, a single mode, and a
+
Use the [[Gamma]] distribution with «alpha» > 1 if you have a sharp lower bound of zero but no sharp upper bound, a single mode, and a
positive skew. The [[LogNormal]] distribution is also an option in this
+
positive skew. The [[LogNormal]] distribution is also an option in this case. [[Gamma]]() is especially appropriate when encoding arrival
case. Gamma() is especially appropriate when encoding arrival
+
times for sets of events. A gamma distribution with a large value for «alpha» is also useful when you wish to use a bell-shaped curve for
times for sets of events. A gamma distribution with a large value
 
for alpha is also useful when you wish to use a bell-shaped curve for
 
 
a positive-only quantity.
 
a positive-only quantity.
  
= Library =
+
== Library ==
 
 
Distribution
 
Distribution
  
= Parameter Estimation =
+
== Parameter Estimation ==
 
+
Suppose <code>X</code> contains sampled historical data indexed by <code>I</code>.  To estimate the parameters of the gamma distribution that best fits this sampled data, the following parameter estimation formulae can be used:
Suppose ''X'' contains sampled historical data indexed by ''I''.  To estimate the parameters of the gamma distribution that best fits this sampled data, the following parameter estimation formulae can be used:
+
:<code>alpha := Mean(X, I)^2 / Variance(X, I)</code>
:alpha := [[Mean]](X,I)^2 / [[Variance]](X,I)
+
:<code>beta  := Variance(X, I) / Mean(X, I)</code>
:beta  := [[Variance]](X,I) / [[Mean]](X,I)
 
  
 
The above is not the maximum likelihood parameter estimation, which turns out to be rather complex (see [http://en.wikipedia.org/wiki/Gamma_Distribution#Maximum_likelihood_estimation Wikipedia]).  However, in practice the above estimation formula perform excellently and are so convenient that more complicated methods are hardly justified.
 
The above is not the maximum likelihood parameter estimation, which turns out to be rather complex (see [http://en.wikipedia.org/wiki/Gamma_Distribution#Maximum_likelihood_estimation Wikipedia]).  However, in practice the above estimation formula perform excellently and are so convenient that more complicated methods are hardly justified.
  
The Gamma distribution with an offset has the form:
+
The Gamma distribution with an «offset» has the form:
[[Gamma]](alpha,beta) - offset
+
:[[Gamma]](alpha, beta) - offset
  
 
To estimate all three parameters, the following heuristic estimation can be used:
 
To estimate all three parameters, the following heuristic estimation can be used:
:alpha  := 4 / [[Skewness]](X,I)^2
+
:<code>alpha  := 4 / Skewness(X, I)^2</code>
:offset := [[Mean]](X,I) - [[SDeviation]](X,I) * [[Sqrt]](alpha)
+
:<code>offset := Mean(X, I) - SDeviation(X, I) * Sqrt(alpha)</code>
:beta  := [[Variance]](X,I) / ([[Mean]](X,I) - offset)
+
:<code>beta  := Variance(X, I) / (Mean(X, I) - offset)</code>
 
 
= See Also =
 
  
* [[Dens_Gamma]] - probability density at x
+
== See Also ==
* [[GammaI]] -- cumulative density at x, incomplete gamma function
+
* [[Dens_Gamma]] - probability density at «x»
 +
* [[GammaI]] -- cumulative density at «x», incomplete gamma function
 
* [[GammaIInv]] -- inverse cumulative density
 
* [[GammaIInv]] -- inverse cumulative density
 
* [[GammaFn]] -- the gamma function
 
* [[GammaFn]] -- the gamma function
* [[Beta]], [[Exponential]], [[LogNormal]] -- related distributions
+
* [[Beta]]  
 +
* [[Exponential]]  
 +
* [[LogNormal]] -- and above, related distributions
 +
* [[SDeviation]]()

Revision as of 23:26, 14 January 2016


Gamma(alpha, beta)

Creates a gamma distribution with shape parameter «alpha» and scale parameter «beta». The scale parameter, «beta», is optional and defaults to beta = 1. The gamma distribution is bounded below by zero (all sample points are positive) and is unbounded from above. It has a theoretical mean of alpha*beta and a theoretical variance of alpha*beta^2.

When «alpha» > 1, the distribution is unimodal with the mode at (alpha - 1)*beta. An exponential distribution results when alpha = 1. As [math]\displaystyle{ \alpha \to \infty }[/math] , the gamma distribution approaches a normal distribution in shape.

The gamma distribution encodes the time required for «alpha» events to occur in a Poisson process with mean arrival time of «beta».

Note

Some textbooks use Rate = 1/beta, instead of «beta», as the scale parameter.

The probability density of the Gamma distribution is

[math]\displaystyle{ p(x) = {{\beta^{-\alpha} x^{\alpha-1} \exp(-x/\beta)}\over{\Gamma(\alpha)}} }[/math]

If you need to compute the density, use the Dens_Gamma(x, alpha, beta) function from the "Distribution Densities.ana" library. For the cumulative probability, use the GammaI(x, a, b) function.

When to use

Use the Gamma distribution with «alpha» > 1 if you have a sharp lower bound of zero but no sharp upper bound, a single mode, and a positive skew. The LogNormal distribution is also an option in this case. Gamma() is especially appropriate when encoding arrival times for sets of events. A gamma distribution with a large value for «alpha» is also useful when you wish to use a bell-shaped curve for a positive-only quantity.

Library

Distribution

Parameter Estimation

Suppose X contains sampled historical data indexed by I. To estimate the parameters of the gamma distribution that best fits this sampled data, the following parameter estimation formulae can be used:

alpha := Mean(X, I)^2 / Variance(X, I)
beta := Variance(X, I) / Mean(X, I)

The above is not the maximum likelihood parameter estimation, which turns out to be rather complex (see Wikipedia). However, in practice the above estimation formula perform excellently and are so convenient that more complicated methods are hardly justified.

The Gamma distribution with an «offset» has the form:

Gamma(alpha, beta) - offset

To estimate all three parameters, the following heuristic estimation can be used:

alpha := 4 / Skewness(X, I)^2
offset := Mean(X, I) - SDeviation(X, I) * Sqrt(alpha)
beta := Variance(X, I) / (Mean(X, I) - offset)

See Also

Comments


You are not allowed to post comments.