#### 52.2.9 Gamma Random Variable

The gamma distribution is a two-parameter family of probability distributions. Maxima uses the parameterization using the shape and scale for the first and second parameters of the distribution.

Function: pdf_gamma (x,a,b)

  Returns the value at x of the density function of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0. To make use of this function, write first `load("distrib")`.

  The shape parameter is a, and the scale parameter is b.

  The pdf is $$ f(x; a, b) = {x^{a-1}e^{-x/b}\over b^a \Gamma(a)} $$

  Categories:Package distrib ·

Function: cdf_gamma (x,a,b)

  Returns the value at x of the distribution function of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0.

  The cdf is $$ F(x; a, b) = \cases{ 1-Q(a,{x\over b}) & for $x \ge 0$ \cr \cr 0 & for $x < 0$ } $$

  where Q(a,z) is the gamma_incomplete_regularized function.

      (%i1) load ("distrib")$

      (%i2) cdf_gamma(3,5,21);
                                                       1
      (%o2)        1 - gamma_incomplete_regularized(5, -)
                                                       7

      (%i3) float(%);
      (%o3)                 4.402663157376807e-7

  Categories:Package distrib ·

Function: quantile_gamma (q,a,b)

  Returns the q-quantile of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0; in other words, this is the inverse of `cdf_gamma`. Argument q must be an element of [0,1]. To make use of this function, write first `load("distrib")`.

  Categories:Package distrib ·

Function: mean_gamma (a,b)

  Returns the mean of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0. To make use of this function, write first `load("distrib")`.

  The mean is $$ E[X] = ab $$

  Categories:Package distrib ·

Function: var_gamma (a,b)

  Returns the variance of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0. To make use of this function, write first `load("distrib")`.

  The variance is $$ V[X] = ab^2 $$

  Categories:Package distrib ·

Function: std_gamma (a,b)

  Returns the standard deviation of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0. To make use of this function, write first `load("distrib")`.

  The standard deviation is $$ D[X] = b\sqrt{a} $$

  Categories:Package distrib ·

Function: skewness_gamma (a,b)

  Returns the skewness coefficient of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0. To make use of this function, write first `load("distrib")`.

  The skewness coefficient is $$ SK[X] = {2\over \sqrt{a}} $$

  Categories:Package distrib ·

Function: kurtosis_gamma (a,b)

  Returns the kurtosis coefficient of a \(\Gamma\left(a,b\right)\) random variable, with a,b>0. To make use of this function, write first `load("distrib")`.

  The kurtosis coefficient is $$ KU[X] = {6\over a} $$

  Categories:Package distrib ·

Function: random_gamma (a,b)
`random_gamma` (a,b,n)

  Returns a \(\Gamma\left(a,b\right)\) random variate, with a,b>0. Calling `random_gamma` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is a combination of two procedures, depending on the value of parameter a:

  For a>=1, Cheng, R.C.H. and Feast, G.M. (1979). Some simple gamma variate generators. Appl. Stat., 28, 3, 290-295.

  For 0<a<1, Ahrens, J.H. and Dieter, U. (1974). Computer methods for sampling from gamma, , poisson and binomial cdf_tributions. Computing, 12, 223-246.

  To make use of this function, write first `load("distrib")`.

  Categories:Package distrib ·Random numbers ·