Gamma

Overview


The gamma distribution is a continuous probability distribution parameterized by two parameters {% \alpha %}, {% \beta %}.

Gamma Function


The gamma function is defined to be
{% \displaystyle \Gamma(z) = \int_0^{\infty} x^{z-1}e^{-x}dx %}

Gamma Distribution


The distribution is given by the following function.
{% f(x,\alpha,\beta) = \frac{x^{\alpha-1}e^{- \beta x}\beta^{\alpha}}{\Gamma(\alpha)} %}
The distribution is dependent on two parameters, {% \alpha %} and {% \beta %}. Atlernatively, it is sometimes stated as a function of {% \alpha %} and {% \lambda %} where
{% \lambda = \frac{1}{\beta} %}

Moments


{% Mean = \alpha \beta = \frac{\alpha}{\lambda} %}
{% Variance = \alpha \beta^2 = \frac{\alpha}{\lambda^2} %}

Gamma Library


The gamma library provides functionality for doing computations with the gamma distribution.

/lib/statistics/distributions/gamma/v1.0.0/gamma.mjs
					

Monte Carlo


the gamma library provides a method for computing simulated gamma variables.


let gm = await import('/lib/statistics/distributions/gamma/v1.0.0/gamma.mjs');
let alpha = 0.5;
let beta = 1;
let variate = gm.random(alpha,beta);
				
Try it!