[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

# 41. Package distrib

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 41.1 Introduction to distrib

Package `distrib` contains a set of functions for making probability computations on both discrete and continuous univariate models.

What follows is a short reminder of basic probabilistic related definitions.

Let f(x) be the density function of an absolute continuous random variable X. The distribution function is defined as

                           x
                          /
                          [
                   F(x) = I     f(u) du
                          ]
                          /
                           minf

which equals the probability Pr(X <= x).

The mean value is a localization parameter and is defined as

                         inf
                        /
                        [
               E[X]  =  I   x f(x) dx
                        ]
                        /
                         minf

The variance is a measure of variation,

                     inf
                    /
                    [                    2
             V[X] = I     f(x) (x - E[X])  dx
                    ]
                    /
                     minf

which is a positive real number. The square root of the variance is the standard deviation, D[X]=sqrt(V[X]), and it is another measure of variation.

The skewness coefficient is a measure of non-symmetry,

                     inf
                    /
                1   [                    3
      SK[X] = ----- I     f(x) (x - E[X])  dx
                  3 ]
              D[X]  /
                     minf

And the kurtosis coefficient measures the peakedness of the distribution,

                     inf
                    /
                1   [                    4
      KU[X] = ----- I     f(x) (x - E[X])  dx - 3
                  4 ]
              D[X]  /
                     minf

If X is gaussian, KU[X]=0. In fact, both skewness and kurtosis are shape parameters used to measure the non-gaussianity of a distribution.

If the random variable X is discrete, the density, or probability, function f(x) takes positive values within certain countable set of numbers x_i, and zero elsewhere. In this case, the distribution function is

                           ====
                           \
                    F(x) =  >    f(x )
                           /        i
                           ====
                          x <= x
                           i

The mean, variance, standard deviation, skewness coefficient and kurtosis coefficient take the form

                           ====
                           \
                    E[X] =  >  x  f(x ) ,
                           /    i    i
                           ====
                            x
                             i

                    ====
                    \                     2
            V[X] =   >    f(x ) (x - E[X])  ,
                    /        i    i
                    ====
                     x
                      i

                   D[X] = sqrt(V[X]),

                         ====
                  1      \                     3
      SK[X] =  -------    >    f(x ) (x - E[X])
               D[X]^3    /        i    i
                         ====
                          x
                           i

and

                         ====
                  1      \                     4
      KU[X] =  -------    >    f(x ) (x - E[X])   - 3 ,
               D[X]^4    /        i    i
                         ====
                          x
                           i

respectively.

There is a naming convention in package `distrib`. Every function name has two parts, the first one makes reference to the function or parameter we want to calculate,

    Functions:
       Density function            (pdf_*)
       Distribution function       (cdf_*)
       Quantile                    (quantile_*)
       Mean                        (mean_*)
       Variance                    (var_*)
       Standard deviation          (std_*)
       Skewness coefficient        (skewness_*)
       Kurtosis coefficient        (kurtosis_*)
       Random variate              (random_*)

The second part is an explicit reference to the probabilistic model,

    Continuous distributions:
       Normal              (*normal)
       Student             (*student_t)
       Chi^2               (*chi2)
       Noncentral Chi^2    (*noncentral_chi2)
       F                   (*f)
       Exponential         (*exp)
       Lognormal           (*lognormal)
       Gamma               (*gamma)
       Beta                (*beta)
       Continuous uniform  (*continuous_uniform)
       Logistic            (*logistic)
       Pareto              (*pareto)
       Weibull             (*weibull)
       Rayleigh            (*rayleigh)
       Laplace             (*laplace)
       Cauchy              (*cauchy)
       Gumbel              (*gumbel)

    Discrete distributions:
       Binomial             (*binomial)
       Poisson              (*poisson)
       Bernoulli            (*bernoulli)
       Geometric            (*geometric)
       Discrete uniform     (*discrete_uniform)
       hypergeometric       (*hypergeometric)
       Negative binomial    (*negative_binomial)
       Finite discrete      (*general_finite_discrete)

For example, `pdf_student_t(x,n)` is the density function of the Student distribution with n degrees of freedom, `std_pareto(a,b)` is the standard deviation of the Pareto distribution with parameters a and b and `kurtosis_poisson(m)` is the kurtosis coefficient of the Poisson distribution with mean m.

In order to make use of package `distrib` you need first to load it by typing

    (%i1) load(distrib)$

For comments, bugs or suggestions, please contact the author at 'mario AT edu DOT xunta DOT es'.

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 41.2 Functions and Variables for continuous distributions

Function: pdf_normal (x, m, s)

  Returns the value at x of the density function of a Normal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: cdf_normal (x, m, s)

  Returns the value at x of the distribution function of a Normal(m,s) random variable, with s>0. This function is defined in terms of Maxima's built-in error function `erf`.

      (%i1) load (distrib)$
      (%i2) assume(s>0)$ cdf_normal(x,m,s);
                                   x - m
                             erf(---------)
                                 sqrt(2) s    1
      (%o3)                  -------------- + -
                                   2          2

  See also `erf`.

Function: quantile_normal (q, m, s)

  Returns the q-quantile of a Normal(m,s) random variable, with s>0; in other words, this is the inverse of `cdf_normal`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

      (%i1) load (distrib)$
      (%i2) quantile_normal(95/100,0,1);
                                            9
      (%o2)             sqrt(2) inverse_erf(--)
                                            10
      (%i3) float(%);
      (%o3)               1.644853626951472

Function: mean_normal (m, s)

  Returns the mean of a Normal(m,s) random variable, with s>0, namely m. To make use of this function, write first `load(distrib)`.

Function: var_normal (m, s)

  Returns the variance of a Normal(m,s) random variable, with s>0, namely s^2. To make use of this function, write first `load(distrib)`.

Function: std_normal (m, s)

  Returns the standard deviation of a Normal(m,s) random variable, with s>0, namely s. To make use of this function, write first `load(distrib)`.

Function: skewness_normal (m, s)

  Returns the skewness coefficient of a Normal(m,s) random variable, with s>0, which is always equal to 0. To make use of this function, write first `load(distrib)`.

Function: kurtosis_normal (m, s)

  Returns the kurtosis coefficient of a Normal(m,s) random variable, with s>0, which is always equal to 0. To make use of this function, write first `load(distrib)`.

Function: random_normal (m, s)
Function: random_normal (m, s, n)

  Returns a Normal(m,s) random variate, with s>0. Calling `random_normal` with a third argument n, a random sample of size n will be simulated.

  This is an implementation of the Box-Mueller algorithm, as described in Knuth, D.E. (1981) Seminumerical Algorithms. The Art of Computer Programming. Addison-Wesley.

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

Function: pdf_student_t (x, n)

  Returns the value at x of the density function of a Student random variable t(n), with n>0 degrees of freedom. To make use of this function, write first `load(distrib)`.

Function: cdf_student_t (x, n)

  Returns the value at x of the distribution function of a Student random variable t(n), with n>0 degrees of freedom.

      (%i1) load (distrib)$
      (%i2) cdf_student_t(1/2, 7/3);
                                               7  1  28
                   beta_incomplete_regularized(-, -, --)
                                               6  2  31
      (%o2)    1 - -------------------------------------
                                     2
      (%i3) float(%);
      (%o3)                .6698450596140415

Function: quantile_student_t (q, n)

  Returns the q-quantile of a Student random variable t(n), with n>0; in other words, this is the inverse of `cdf_student_t`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_student_t (n)

  Returns the mean of a Student random variable t(n), with n>0, which is always equal to 0. To make use of this function, write first `load(distrib)`.

Function: var_student_t (n)

  Returns the variance of a Student random variable t(n), with n>2.

      (%i1) load (distrib)$
      (%i2) assume(n>2)$  var_student_t(n);
                                      n
      (%o3)                         -----
                                    n - 2

Function: std_student_t (n)

  Returns the standard deviation of a Student random variable t(n), with n>2. To make use of this function, write first `load(distrib)`.

Function: skewness_student_t (n)

  Returns the skewness coefficient of a Student random variable t(n), with n>3, which is always equal to 0. To make use of this function, write first `load(distrib)`.

Function: kurtosis_student_t (n)

  Returns the kurtosis coefficient of a Student random variable t(n), with n>4. To make use of this function, write first `load(distrib)`.

Function: random_student_t (n)
Function: random_student_t (n, m)

  Returns a Student random variate t(n), with n>0. Calling `random_student_t` with a second argument m, a random sample of size m will be simulated.

  The implemented algorithm is based on the fact that if Z is a normal random variable N(0,1) and S^2 is a chi square random variable with n degrees of freedom, Chi^2(n), then

                                 Z
                       X = -------------
                           /   2  \ 1/2
                           |  S   |
                           | ---  |
                           \  n   /

  is a Student random variable with n degrees of freedom, t(n).

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

Function: pdf_noncentral_student_t (x, n, ncp)

  Returns the value at x of the density function of a noncentral Student random variable nc_t(n,ncp), with n>0 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first `load(distrib)`.

  Sometimes an extra work is necessary to get the final result.

      (%i1) load (distrib)$
      (%i2) expand(pdf_noncentral_student_t(3,5,0.1));
             .01370030107589574 sqrt(5)
      (%o2)  --------------------------
             sqrt(2) sqrt(14) sqrt(%pi)
         1.654562884111515E-4 sqrt(5)
       + ----------------------------
                  sqrt(%pi)
         .02434921505438663 sqrt(5)
       + --------------------------
                    %pi
      (%i3) float(%);
      (%o3)          .02080593159405669

Function: cdf_noncentral_student_t (x, n, ncp)

  Returns the value at x of the distribution function of a noncentral Student random variable nc_t(n,ncp), with n>0 degrees of freedom and noncentrality parameter ncp. This function has no closed form and it is numerically computed if the global variable `numer` equals `true` or at least one of the arguments is a float, otherwise it returns a nominal expression.

      (%i1) load (distrib)$
      (%i2) cdf_noncentral_student_t(-2,5,-5);
      (%o2) cdf_noncentral_student_t(- 2, 5, - 5)
      (%i3) cdf_noncentral_student_t(-2.0,5,-5);
      (%o3)          .9952030093319743

Function: quantile_noncentral_student_t (q, n, ncp)

  Returns the q-quantile of a noncentral Student random variable nc_t(n,ncp), with n>0 degrees of freedom and noncentrality parameter ncp; in other words, this is the inverse of `cdf_noncentral_student_t`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_noncentral_student_t (n, ncp)

  Returns the mean of a noncentral Student random variable nc_t(n,ncp), with n>1 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first `load(distrib)`.

      (%i1) load (distrib)$
      (%i2) (assume(df>1), mean_noncentral_student_t(df,k));
                         df - 1
                   gamma(------) sqrt(df) k
                           2
      (%o2)        ------------------------
                                    df
                      sqrt(2) gamma(--)
                                    2

Function: var_noncentral_student_t (n, ncp)

  Returns the variance of a noncentral Student random variable nc_t(n,ncp), with n>2 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first `load(distrib)`.

Function: std_noncentral_student_t (n, ncp)

  Returns the standard deviation of a noncentral Student random variable nc_t(n,ncp), with n>2 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first `load(distrib)`.

Function: skewness_noncentral_student_t (n, ncp)

  Returns the skewness coefficient of a noncentral Student random variable nc_t(n,ncp), with n>3 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first `load(distrib)`.

Function: kurtosis_noncentral_student_t (n, ncp)

  Returns the kurtosis coefficient of a noncentral Student random variable nc_t(n,ncp), with n>4 degrees of freedom and noncentrality parameter ncp. To make use of this function, write first `load(distrib)`.

Function: random_noncentral_student_t (n, ncp)
Function: random_noncentral_student_t (n, ncp, m)

  Returns a noncentral Student random variate nc_t(n,ncp), with n>0. Calling `random_noncentral_student_t` with a third argument m, a random sample of size m will be simulated.

  The implemented algorithm is based on the fact that if X is a normal random variable N(ncp,1) and S^2 is a chi square random variable with n degrees of freedom, Chi^2(n), then

                                 X
                       U = -------------
                           /   2  \ 1/2
                           |  S   |
                           | ---  |
                           \  n   /

  is a noncentral Student random variable with n degrees of freedom and noncentrality parameter ncp, nc_t(n,ncp).

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

Function: pdf_chi2 (x, n)

  Returns the value at x of the density function of a Chi-square random variable Chi^2(n), with n>0.

  The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma density is returned.

      (%i1) load (distrib)$
      (%i2) pdf_chi2(x,n);
                                          n
      (%o2)                  pdf_gamma(x, -, 2)
                                          2
      (%i3) assume(x>0, n>0)$  pdf_chi2(x,n);
                               n/2 - 1   - x/2
                              x        %e
      (%o4)                   ----------------
                                n/2       n
                               2    gamma(-)
                                          2

Function: cdf_chi2 (x, n)

  Returns the value at x of the distribution function of a Chi-square random variable Chi^2(n), with n>0.

      (%i1) load (distrib)$
      (%i2) cdf_chi2(3,4);
                                                     3
      (%o2)      1 - gamma_incomplete_regularized(2, -)
                                                     2
      (%i3) float(%);
      (%o3)               .4421745996289256

Function: quantile_chi2 (q, n)

  Returns the q-quantile of a Chi-square random variable Chi^2(n), with n>0; in other words, this is the inverse of `cdf_chi2`. Argument q must be an element of [0,1].

  This function has no closed form and it is numerically computed if the global variable `numer` equals `true`, otherwise it returns a nominal expression based on the gamma quantile function, since the Chi^2(n) random variable is equivalent to the Gamma(n/2,2).

      (%i1) load (distrib)$
      (%i2) quantile_chi2(0.99,9);
      (%o2)                   21.66599433346194
      (%i3) quantile_chi2(0.99,n);
                                              n
      (%o3)              quantile_gamma(0.99, -, 2)
                                              2

Function: mean_chi2 (n)

  Returns the mean of a Chi-square random variable Chi^2(n), with n>0.

  The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma mean is returned.

      (%i1) load (distrib)$
      (%i2) mean_chi2(n);
                                         n
      (%o2)                   mean_gamma(-, 2)
                                         2
      (%i3) assume(n>0)$ mean_chi2(n);
      (%o4)                           n

Function: var_chi2 (n)

  Returns the variance of a Chi-square random variable Chi^2(n), with n>0.

  The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma variance is returned.

      (%i1) load (distrib)$
      (%i2) var_chi2(n);
                                         n
      (%o2)                    var_gamma(-, 2)
                                         2
      (%i3) assume(n>0)$ var_chi2(n);
      (%o4)                          2 n

Function: std_chi2 (n)

  Returns the standard deviation of a Chi-square random variable Chi^2(n), with n>0.

  The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma standard deviation is returned.

      (%i1) load (distrib)$
      (%i2) std_chi2(n);
                                         n
      (%o2)                    std_gamma(-, 2)
                                         2
      (%i3) assume(n>0)$ std_chi2(n);
      (%o4)                    sqrt(2) sqrt(n)

Function: skewness_chi2 (n)

  Returns the skewness coefficient of a Chi-square random variable Chi^2(n), with n>0.

  The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma skewness coefficient is returned.

      (%i1) load (distrib)$
      (%i2) skewness_chi2(n);
                                           n
      (%o2)                 skewness_gamma(-, 2)
                                           2
      (%i3) assume(n>0)$ skewness_chi2(n);
                                  2 sqrt(2)
      (%o4)                       ---------
                                   sqrt(n)

Function: kurtosis_chi2 (n)

  Returns the kurtosis coefficient of a Chi-square random variable Chi^2(n), with n>0.

  The Chi^2(n) random variable is equivalent to the Gamma(n/2,2), therefore when Maxima has not enough information to get the result, a noun form based on the gamma kurtosis coefficient is returned.

      (%i1) load (distrib)$
      (%i2) kurtosis_chi2(n);
                                           n
      (%o2)                 kurtosis_gamma(-, 2)
                                           2
      (%i3) assume(n>0)$ kurtosis_chi2(n);
                                     12
      (%o4)                          --
                                     n

Function: random_chi2 (n)
Function: random_chi2 (n, m)

  Returns a Chi-square random variate Chi^2(n), with n>0. Calling `random_chi2` with a second argument m, a random sample of size m will be simulated.

  The simulation is based on the Ahrens-Cheng algorithm. See `random_gamma` for details.

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

Function: pdf_noncentral_chi2 (x, n, ncp)

  Returns the value at x of the density function of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0. To make use of this function, write first `load(distrib)`.

Function: cdf_noncentral_chi2 (x, n, ncp)

  Returns the value at x of the distribution function of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0. To make use of this function, write first `load(distrib)`.

Function: quantile_noncentral_chi2 (q, n, ncp)

  Returns the q-quantile of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0; in other words, this is the inverse of `cdf_noncentral_chi2`. Argument q must be an element of [0,1].

  This function has no closed form and it is numerically computed if the global variable `numer` equals `true`, otherwise it returns a nominal expression.

Function: mean_noncentral_chi2 (n, ncp)

  Returns the mean of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0.

Function: var_noncentral_chi2 (n, ncp)

  Returns the variance of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0.

Function: std_noncentral_chi2 (n, ncp)

  Returns the standard deviation of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0.

Function: skewness_noncentral_chi2 (n, ncp)

  Returns the skewness coefficient of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0.

Function: kurtosis_noncentral_chi2 (n, ncp)

  Returns the kurtosis coefficient of a noncentral Chi-square random variable nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0.

Function: random_noncentral_chi2 (n, ncp)
Function: random_noncentral_chi2 (n, ncp, m)

  Returns a noncentral Chi-square random variate nc_Chi^2(n,ncp), with n>0 and noncentrality parameter ncp>=0. Calling `random_noncentral_chi2` with a third argument m, a random sample of size m will be simulated.

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

Function: pdf_f (x, m, n)

  Returns the value at x of the density function of a F random variable F(m,n), with m,n>0. To make use of this function, write first `load(distrib)`.

Function: cdf_f (x, m, n)

  Returns the value at x of the distribution function of a F random variable F(m,n), with m,n>0.

      (%i1) load (distrib)$
      (%i2) cdf_f(2,3,9/4);
                                               9  3  3
      (%o2)    1 - beta_incomplete_regularized(-, -, --)
                                               8  2  11
      (%i3) float(%);
      (%o3)                 0.66756728179008

Function: quantile_f (q, m, n)

  Returns the q-quantile of a F random variable F(m,n), with m,n>0; in other words, this is the inverse of `cdf_f`. Argument q must be an element of [0,1].

  This function has no closed form and it is numerically computed if the global variable `numer` equals `true`, otherwise it returns a nominal expression.

      (%i1) load (distrib)$
      (%i2) quantile_f(2/5,sqrt(3),5);
                                     2
      (%o2)               quantile_f(-, sqrt(3), 5)
                                     5
      (%i3) %,numer;
      (%o3)                   0.518947838573693

Function: mean_f (m, n)

  Returns the mean of a F random variable F(m,n), with m>0, n>2. To make use of this function, write first `load(distrib)`.

Function: var_f (m,n)

  Returns the variance of a F random variable F(m,n), with m>0, n>4. To make use of this function, write first `load(distrib)`.

Function: std_f (m, n)

  Returns the standard deviation of a F random variable F(m,n), with m>0, n>4. To make use of this function, write first `load(distrib)`.

Function: skewness_f (m, n)

  Returns the skewness coefficient of a F random variable F(m,n), with m>0, n>6. To make use of this function, write first `load(distrib)`.

Function: kurtosis_f (m, n)

  Returns the kurtosis coefficient of a F random variable F(m,n), with m>0, n>8. To make use of this function, write first `load(distrib)`.

Function: random_f (m, n)
Function: random_f (m, n, k)

  Returns a F random variate F(m,n), with m,n>0. Calling `random_f` with a third argument k, a random sample of size k will be simulated.

  The simulation algorithm is based on the fact that if X is a Chi^2(m) random variable and Y is a Chi^2(n) random variable, then

                              n X
                          F = ---
                              m Y

  is a F random variable with m and n degrees of freedom, F(m,n).

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

Function: pdf_exp (x, m)

  Returns the value at x of the density function of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull density is returned.

      (%i1) load (distrib)$
      (%i2) pdf_exp(x,m);
                                              1
      (%o2)                 pdf_weibull(x, 1, -)
                                              m
      (%i3) assume(x>0,m>0)$  pdf_exp(x,m);
                                      - m x
      (%o4)                       m %e

Function: cdf_exp (x, m)

  Returns the value at x of the distribution function of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull distribution is returned.

      (%i1) load (distrib)$
      (%i2) cdf_exp(x,m);
                                              1
      (%o2)                 cdf_weibull(x, 1, -)
                                              m
      (%i3) assume(x>0,m>0)$  cdf_exp(x,m);
                                       - m x
      (%o4)                      1 - %e

Function: quantile_exp (q, m)

  Returns the q-quantile of an Exponential(m) random variable, with m>0; in other words, this is the inverse of `cdf_exp`. Argument q must be an element of [0,1].

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull quantile is returned.

      (%i1) load (distrib)$
      (%i2) quantile_exp(0.56,5);
      (%o2)                   .1641961104139661
      (%i3) quantile_exp(0.56,m);
                                                  1
      (%o3)             quantile_weibull(0.56, 1, -)
                                                  m

Function: mean_exp (m)

  Returns the mean of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull mean is returned.

      (%i1) load (distrib)$
      (%i2) mean_exp(m);
                                             1
      (%o2)                  mean_weibull(1, -)
                                             m
      (%i3) assume(m>0)$  mean_exp(m);
                                      1
      (%o4)                           -
                                      m

Function: var_exp (m)

  Returns the variance of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull variance is returned.

      (%i1) load (distrib)$
      (%i2) var_exp(m);
                                             1
      (%o2)                   var_weibull(1, -)
                                             m
      (%i3) assume(m>0)$  var_exp(m);
                                     1
      (%o4)                          --
                                      2
                                     m

Function: std_exp (m)

  Returns the standard deviation of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull standard deviation is returned.

      (%i1) load (distrib)$
      (%i2) std_exp(m);
                                             1
      (%o2)                   std_weibull(1, -)
                                             m
      (%i3) assume(m>0)$  std_exp(m);
                                      1
      (%o4)                           -
                                      m

Function: skewness_exp (m)

  Returns the skewness coefficient of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull skewness coefficient is returned.

      (%i1) load (distrib)$
      (%i2) skewness_exp(m);
                                               1
      (%o2)                skewness_weibull(1, -)
                                               m
      (%i3) assume(m>0)$  skewness_exp(m);
      (%o4)                           2

Function: kurtosis_exp (m)

  Returns the kurtosis coefficient of an Exponential(m) random variable, with m>0.

  The Exponential(m) random variable is equivalent to the Weibull(1,1/m), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull kurtosis coefficient is returned.

      (%i1) load (distrib)$
      (%i2) kurtosis_exp(m);
                                               1
      (%o2)                kurtosis_weibull(1, -)
                                               m
      (%i3) assume(m>0)$  kurtosis_exp(m);
      (%o4)                           6

Function: random_exp (m)
Function: random_exp (m, k)

  Returns an Exponential(m) random variate, with m>0. Calling `random_exp` with a second argument k, a random sample of size k will be simulated.

  The simulation algorithm is based on the general inverse method.

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

Function: pdf_lognormal (x, m, s)

  Returns the value at x of the density function of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: cdf_lognormal (x, m, s)

  Returns the value at x of the distribution function of a Lognormal(m,s) random variable, with s>0. This function is defined in terms of Maxima's built-in error function `erf`.

      (%i1) load (distrib)$
      (%i2) assume(x>0, s>0)$  cdf_lognormal(x,m,s);
                                 log(x) - m
                             erf(----------)
                                 sqrt(2) s     1
      (%o3)                  --------------- + -
                                    2          2

  See also `erf`.

Function: quantile_lognormal (q, m, s)

  Returns the q-quantile of a Lognormal(m,s) random variable, with s>0; in other words, this is the inverse of `cdf_lognormal`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

      (%i1) load (distrib)$
      (%i2) quantile_lognormal(95/100,0,1);
                        sqrt(2) inverse_erf(9/10)
      (%o2)           %e
      (%i3) float(%);
      (%o3)               5.180251602233015

Function: mean_lognormal (m, s)

  Returns the mean of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: var_lognormal (m, s)

  Returns the variance of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: std_lognormal (m, s)

  Returns the standard deviation of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: skewness_lognormal (m, s)

  Returns the skewness coefficient of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: kurtosis_lognormal (m, s)

  Returns the kurtosis coefficient of a Lognormal(m,s) random variable, with s>0. To make use of this function, write first `load(distrib)`.

Function: random_lognormal (m, s)
Function: random_lognormal (m, s, n)

  Returns a Lognormal(m,s) random variate, with s>0. Calling `random_lognormal` with a third argument n, a random sample of size n will be simulated.

  Log-normal variates are simulated by means of random normal variates. See `random_normal` for details.

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

Function: pdf_gamma (x, a, b)

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

Function: cdf_gamma (x, a, b)

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

      (%i1) load (distrib)$
      (%i2) cdf_gamma(3,5,21);
                                                    1
      (%o2)     1 - gamma_incomplete_regularized(5, -)
                                                    7
      (%i3) float(%);
      (%o3)              4.402663157376807E-7

Function: quantile_gamma (q, a, b)

  Returns the q-quantile of a Gamma(a,b) 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)`.

Function: mean_gamma (a, b)

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

Function: var_gamma (a, b)

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

Function: std_gamma (a, b)

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

Function: skewness_gamma (a, b)

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

Function: kurtosis_gamma (a, b)

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

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

  Returns a Gamma(a,b) 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, beta, poisson and binomial cdf_tributions. Computing, 12, 223-246.

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

Function: pdf_beta (x, a, b)

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

Function: cdf_beta (x, a, b)

  Returns the value at x of the distribution function of a Beta(a,b) random variable, with a,b>0.

      (%i1) load (distrib)$
      (%i2) cdf_beta(1/3,15,2);
                                   11
      (%o2)                     --------
                                14348907
      (%i3) float(%);
      (%o3)              7.666089131388195E-7

Function: quantile_beta (q, a, b)

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

Function: mean_beta (a, b)

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

Function: var_beta (a, b)

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

Function: std_beta (a, b)

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

Function: skewness_beta (a, b)

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

Function: kurtosis_beta (a, b)

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

Function: random_beta (a, b)
Function: random_beta (a, b, n)

  Returns a Beta(a,b) random variate, with a,b>0. Calling `random_beta` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is defined in Cheng, R.C.H. (1978). Generating Beta Variates with Nonintegral Shape Parameters. Communications of the ACM, 21:317-322

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

Function: pdf_continuous_uniform (x, a, b)

  Returns the value at x of the density function of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: cdf_continuous_uniform (x, a, b)

  Returns the value at x of the distribution function of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: quantile_continuous_uniform (q, a, b)

  Returns the q-quantile of a Continuous Uniform(a,b) random variable, with a<b; in other words, this is the inverse of `cdf_continuous_uniform`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_continuous_uniform (a, b)

  Returns the mean of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: var_continuous_uniform (a, b)

  Returns the variance of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: std_continuous_uniform (a, b)

  Returns the standard deviation of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: skewness_continuous_uniform (a, b)

  Returns the skewness coefficient of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: kurtosis_continuous_uniform (a, b)

  Returns the kurtosis coefficient of a Continuous Uniform(a,b) random variable, with a<b. To make use of this function, write first `load(distrib)`.

Function: random_continuous_uniform (a, b)
Function: random_continuous_uniform (a, b, n)

  Returns a Continuous Uniform(a,b) random variate, with a<b. Calling `random_continuous_uniform` with a third argument n, a random sample of size n will be simulated.

  This is a direct application of the `random` built-in Maxima function.

  See also `random`. To make use of this function, write first `load(distrib)`.

Function: pdf_logistic (x, a, b)

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

Function: cdf_logistic (x, a, b)

  Returns the value at x of the distribution function of a Logistic(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)`.

Function: quantile_logistic (q, a, b)

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

Function: mean_logistic (a, b)

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

Function: var_logistic (a, b)

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

Function: std_logistic (a, b)

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

Function: skewness_logistic (a, b)

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

Function: kurtosis_logistic (a, b)

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

Function: random_logistic (a, b)
Function: random_logistic (a, b, n)

  Returns a Logistic(a,b) random variate, with b>0. Calling `random_logistic` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

Function: pdf_pareto (x, a, b)

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

Function: cdf_pareto (x, a, b)

  Returns the value at x of the distribution function of a Pareto(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)`.

Function: quantile_pareto (q, a, b)

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

Function: mean_pareto (a, b)

  Returns the mean of a Pareto(a,b) random variable, with a>1,b>0. To make use of this function, write first `load(distrib)`.

Function: var_pareto (a, b)

  Returns the variance of a Pareto(a,b) random variable, with a>2,b>0. To make use of this function, write first `load(distrib)`.

Function: std_pareto (a, b)

  Returns the standard deviation of a Pareto(a,b) random variable, with a>2,b>0. To make use of this function, write first `load(distrib)`.

Function: skewness_pareto (a, b)

  Returns the skewness coefficient of a Pareto(a,b) random variable, with a>3,b>0. To make use of this function, write first `load(distrib)`.

Function: kurtosis_pareto (a, b)

  Returns the kurtosis coefficient of a Pareto(a,b) random variable, with a>4,b>0. To make use of this function, write first `load(distrib)`.

Function: random_pareto (a, b)
Function: random_pareto (a, b, n)

  Returns a Pareto(a,b) random variate, with a>0,b>0. Calling `random_pareto` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

Function: pdf_weibull (x, a, b)

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

Function: cdf_weibull (x, a, b)

  Returns the value at x of the distribution function of a Weibull(a,b) random variable, with a,b>0. To make use of this function, write first `load(distrib)`.

Function: quantile_weibull (q, a, b)

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

Function: mean_weibull (a, b)

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

Function: var_weibull (a, b)

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

Function: std_weibull (a, b)

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

Function: skewness_weibull (a, b)

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

Function: kurtosis_weibull (a, b)

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

Function: random_weibull (a, b)
Function: random_weibull (a, b, n)

  Returns a Weibull(a,b) random variate, with a,b>0. Calling `random_weibull` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

Function: pdf_rayleigh (x, b)

  Returns the value at x of the density function of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull density is returned.

      (%i1) load (distrib)$
      (%i2) pdf_rayleigh(x,b);
                                              1
      (%o2)                 pdf_weibull(x, 2, -)
                                              b
      (%i3) assume(x>0,b>0)$ pdf_rayleigh(x,b);
                                          2  2
                                 2     - b  x
      (%o4)                   2 b  x %e

Function: cdf_rayleigh (x, b)

  Returns the value at x of the distribution function of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull distribution is returned.

      (%i1) load (distrib)$
      (%i2) cdf_rayleigh(x,b);
                                              1
      (%o2)                 cdf_weibull(x, 2, -)
                                              b
      (%i3) assume(x>0,b>0)$ cdf_rayleigh(x,b);
                                         2  2
                                      - b  x
      (%o4)                     1 - %e

Function: quantile_rayleigh (q, b)

  Returns the q-quantile of a Rayleigh(b) random variable, with b>0; in other words, this is the inverse of `cdf_rayleigh`. Argument q must be an element of [0,1].

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull quantile is returned.

      (%i1) load (distrib)$
      (%i2) quantile_rayleigh(0.99,b);
                                                  1
      (%o2)             quantile_weibull(0.99, 2, -)
                                                  b
      (%i3) assume(x>0,b>0)$ quantile_rayleigh(0.99,b);
                              2.145966026289347
      (%o4)                   -----------------
                                      b

Function: mean_rayleigh (b)

  Returns the mean of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull mean is returned.

      (%i1) load (distrib)$
      (%i2) mean_rayleigh(b);
                                             1
      (%o2)                  mean_weibull(2, -)
                                             b
      (%i3) assume(b>0)$ mean_rayleigh(b);
                                  sqrt(%pi)
      (%o4)                       ---------
                                     2 b

Function: var_rayleigh (b)

  Returns the variance of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull variance is returned.

      (%i1) load (distrib)$
      (%i2) var_rayleigh(b);
                                             1
      (%o2)                   var_weibull(2, -)
                                             b
      (%i3) assume(b>0)$ var_rayleigh(b);
                                       %pi
                                   1 - ---
                                        4
      (%o4)                        -------
                                      2
                                     b

Function: std_rayleigh (b)

  Returns the standard deviation of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull standard deviation is returned.

      (%i1) load (distrib)$
      (%i2) std_rayleigh(b);
                                             1
      (%o2)                   std_weibull(2, -)
                                             b
      (%i3) assume(b>0)$ std_rayleigh(b);
                                         %pi
                                sqrt(1 - ---)
                                          4
      (%o4)                     -------------
                                      b

Function: skewness_rayleigh (b)

  Returns the skewness coefficient of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull skewness coefficient is returned.

      (%i1) load (distrib)$
      (%i2) skewness_rayleigh(b);
                                               1
      (%o2)                skewness_weibull(2, -)
                                               b
      (%i3) assume(b>0)$ skewness_rayleigh(b);
                               3/2
                            %pi      3 sqrt(%pi)
                            ------ - -----------
                              4           4
      (%o4)                 --------------------
                                     %pi 3/2
                                (1 - ---)
                                      4

Function: kurtosis_rayleigh (b)

  Returns the kurtosis coefficient of a Rayleigh(b) random variable, with b>0.

  The Rayleigh(b) random variable is equivalent to the Weibull(2,1/b), therefore when Maxima has not enough information to get the result, a noun form based on the Weibull kurtosis coefficient is returned.

      (%i1) load (distrib)$
      (%i2) kurtosis_rayleigh(b);
                                               1
      (%o2)                kurtosis_weibull(2, -)
                                               b
      (%i3) assume(b>0)$ kurtosis_rayleigh(b);
                                        2
                                   3 %pi
                               2 - ------
                                     16
      (%o4)                    ---------- - 3
                                    %pi 2
                               (1 - ---)
                                     4

Function: random_rayleigh (b)
Function: random_rayleigh (b, n)

  Returns a Rayleigh(b) random variate, with b>0. Calling `random_rayleigh` with a second argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

Function: pdf_laplace (x, a, b)

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

Function: cdf_laplace (x, a, b)

  Returns the value at x of the distribution function of a Laplace(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)`.

Function: quantile_laplace (q, a, b)

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

Function: mean_laplace (a, b)

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

Function: var_laplace (a, b)

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

Function: std_laplace (a, b)

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

Function: skewness_laplace (a, b)

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

Function: kurtosis_laplace (a, b)

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

Function: random_laplace (a, b)
Function: random_laplace (a, b, n)

  Returns a Laplace(a,b) random variate, with b>0. Calling `random_laplace` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

Function: pdf_cauchy (x, a, b)

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

Function: cdf_cauchy (x, a, b)

  Returns the value at x of the distribution function of a Cauchy(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)`.

Function: quantile_cauchy (q, a, b)

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

Function: random_cauchy (a, b)
Function: random_cauchy (a, b, n)

  Returns a Cauchy(a,b) random variate, with b>0. Calling `random_cauchy` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

Function: pdf_gumbel (x, a, b)

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

Function: cdf_gumbel (x, a, b)

  Returns the value at x of the distribution function of a Gumbel(a,b) random variable, with b>0. To make use of this function, write first `load(distrib)`.

Function: quantile_gumbel (q, a, b)

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

Function: mean_gumbel (a, b)

  Returns the mean of a Gumbel(a,b) random variable, with b>0.

      (%i1) load (distrib)$
      (%i2) assume(b>0)$  mean_gumbel(a,b);
      (%o3)                     %gamma b + a

  where symbol `%gamma` stands for the Euler-Mascheroni constant. See also `%gamma`.

Function: var_gumbel (a, b)

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

Function: std_gumbel (a, b)

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

Function: skewness_gumbel (a, b)

  Returns the skewness coefficient of a Gumbel(a,b) random variable, with b>0.

      (%i1) load (distrib)$
      (%i2) assume(b>0)$ skewness_gumbel(a,b);
                             12 sqrt(6) zeta(3)
      (%o3)                  ------------------
                                       3
                                    %pi
      (%i4) numer:true$ skewness_gumbel(a,b);
      (%o5)                   1.139547099404649

  where `zeta` stands for the Riemann's zeta function.

Function: kurtosis_gumbel (a, b)

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

Function: random_gumbel (a, b)
Function: random_gumbel (a, b, n)

  Returns a Gumbel(a,b) random variate, with b>0. Calling `random_gumbel` with a third argument n, a random sample of size n will be simulated.

  The implemented algorithm is based on the general inverse method.

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

[ < ] | [ > ] |  | [ << ] | [ Up ] | [ >> ] |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

## 41.3 Functions and Variables for discrete distributions

Function: pdf_general_finite_discrete (x, v)

  Returns the value at x of the probability function of a general finite discrete random variable, with vector probabilities v, such that `Pr(X=i) = v_i`. Vector v can be a list of nonnegative expressions, whose components will be normalized to get a vector of probabilities. To make use of this function, write first `load(distrib)`.

  Examples:

      (%i1) load (distrib)$
      (%i2) pdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
                                      4
      (%o2)                           -
                                      7
      (%i3) pdf_general_finite_discrete(2, [1, 4, 2]);
                                      4
      (%o3)                           -
                                      7

Function: cdf_general_finite_discrete (x, v)

  Returns the value at x of the distribution function of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

  Examples:

      (%i1) load (distrib)$
      (%i2) cdf_general_finite_discrete(2, [1/7, 4/7, 2/7]);
                                      5
      (%o2)                           -
                                      7
      (%i3) cdf_general_finite_discrete(2, [1, 4, 2]);
                                      5
      (%o3)                           -
                                      7
      (%i4) cdf_general_finite_discrete(2+1/2, [1, 4, 2]);
                                      5
      (%o4)                           -
                                      7

Function: quantile_general_finite_discrete (q, v)

  Returns the q-quantile of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

Function: mean_general_finite_discrete (v)

  Returns the mean of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

Function: var_general_finite_discrete (v)

  Returns the variance of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

Function: std_general_finite_discrete (v)

  Returns the standard deviation of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

Function: skewness_general_finite_discrete (v)

  Returns the skewness coefficient of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

Function: kurtosis_general_finite_discrete (v)

  Returns the kurtosis coefficient of a general finite discrete random variable, with vector probabilities v.

  See `pdf_general_finite_discrete` for more details.

Function: random_general_finite_discrete (v)
Function: random_general_finite_discrete (v, m)

  Returns a general finite discrete random variate, with vector probabilities v. Calling `random_general_finite_discrete` with a second argument m, a random sample of size m will be simulated.

  See `pdf_general_finite_discrete` for more details.

  Examples:

      (%i1) load (distrib)$
      (%i2) random_general_finite_discrete([1,3,1,5]);
      (%o2)                          4
      (%i3) random_general_finite_discrete([1,3,1,5], 10);
      (%o3)           [4, 2, 2, 3, 2, 4, 4, 1, 2, 2]

Function: pdf_binomial (x, n, p)

  Returns the value at x of the probability function of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: cdf_binomial (x, n, p)

  Returns the value at x of the distribution function of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer.

      (%i1) load (distrib)$
      (%i2) cdf_binomial(5,7,1/6);
                                  7775
      (%o2)                       ----
                                  7776
      (%i3) float(%);
      (%o3)               .9998713991769548

Function: quantile_binomial (q, n, p)

  Returns the q-quantile of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer; in other words, this is the inverse of `cdf_binomial`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_binomial (n, p)

  Returns the mean of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: var_binomial (n, p)

  Returns the variance of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: std_binomial (n, p)

  Returns the standard deviation of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: skewness_binomial (n, p)

  Returns the skewness coefficient of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: kurtosis_binomial (n, p)

  Returns the kurtosis coefficient of a Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: random_binomial (n, p)
Function: random_binomial (n, p, m)

  Returns a Binomial(n,p) random variate, with 0<p<1 and n a positive integer. Calling `random_binomial` with a third argument m, a random sample of size m will be simulated.

  The implemented algorithm is based on the one described in Kachitvichyanukul, V. and Schmeiser, B.W. (1988) Binomial Random Variate Generation. Communications of the ACM, 31, Feb., 216.

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

Function: pdf_poisson (x, m)

  Returns the value at x of the probability function of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)`.

Function: cdf_poisson (x, m)

  Returns the value at x of the distribution function of a Poisson(m) random variable, with m>0.

      (%i1) load (distrib)$
      (%i2) cdf_poisson(3,5);
      (%o2)       gamma_incomplete_regularized(4, 5)
      (%i3) float(%);
      (%o3)               .2650259152973623

Function: quantile_poisson (q, m)

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

Function: mean_poisson (m)

  Returns the mean of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)`.

Function: var_poisson (m)

  Returns the variance of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)`.

Function: std_poisson (m)

  Returns the standard deviation of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)`.

Function: skewness_poisson (m)

  Returns the skewness coefficient of a Poisson(m) random variable, with m>0. To make use of this function, write first `load(distrib)`.

Function: kurtosis_poisson (m)

  Returns the kurtosis coefficient of a Poisson random variable Poi(m), with m>0. To make use of this function, write first `load(distrib)`.

Function: random_poisson (m)
Function: random_poisson (m, n)

  Returns a Poisson(m) random variate, with m>0. Calling `random_poisson` with a second argument n, a random sample of size n will be simulated.

  The implemented algorithm is the one described in Ahrens, J.H. and Dieter, U. (1982) Computer Generation of Poisson Deviates From Modified Normal Distributions. ACM Trans. Math. Software, 8, 2, June,163-179.

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

Function: pdf_bernoulli (x, p)

  Returns the value at x of the probability function of a Bernoulli(p) random variable, with 0<p<1.

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p), therefore when Maxima has not enough information to get the result, a noun form based on the binomial probability function is returned.

      (%i1) load (distrib)$
      (%i2) pdf_bernoulli(1,p);
      (%o2)                 pdf_binomial(1, 1, p)
      (%i3) assume(0<p,p<1)$ pdf_bernoulli(1,p);
      (%o4)                           p

Function: cdf_bernoulli (x, p)

  Returns the value at x of the distribution function of a Bernoulli(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: quantile_bernoulli (q, p)

  Returns the q-quantile of a Bernoulli(p) random variable, with 0<p<1; in other words, this is the inverse of `cdf_bernoulli`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_bernoulli (p)

  Returns the mean of a Bernoulli(p) random variable, with 0<p<1.

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p), therefore when Maxima has not enough information to get the result, a noun form based on the binomial mean is returned.

      (%i1) load (distrib)$
      (%i2) mean_bernoulli(p);
      (%o2)                  mean_binomial(1, p)
      (%i3) assume(0<p,p<1)$ mean_bernoulli(p);
      (%o4)                           p

Function: var_bernoulli (p)

  Returns the variance of a Bernoulli(p) random variable, with 0<p<1.

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p), therefore when Maxima has not enough information to get the result, a noun form based on the binomial variance is returned.

      (%i1) load (distrib)$
      (%i2) var_bernoulli(p);
      (%o2)                  var_binomial(1, p)
      (%i3) assume(0<p,p<1)$ var_bernoulli(p);
      (%o4)                       (1 - p) p

Function: std_bernoulli (p)

  Returns the standard deviation of a Bernoulli(p) random variable, with 0<p<1.

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p), therefore when Maxima has not enough information to get the result, a noun form based on the binomial standard deviation is returned.

      (%i1) load (distrib)$
      (%i2) std_bernoulli(p);
      (%o2)                  std_binomial(1, p)
      (%i3) assume(0<p,p<1)$ std_bernoulli(p);
      (%o4)                  sqrt(1 - p) sqrt(p)

Function: skewness_bernoulli (p)

  Returns the skewness coefficient of a Bernoulli(p) random variable, with 0<p<1.

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p), therefore when Maxima has not enough information to get the result, a noun form based on the binomial skewness coefficient is returned.

      (%i1) load (distrib)$
      (%i2) skewness_bernoulli(p);
      (%o2)                skewness_binomial(1, p)
      (%i3) assume(0<p,p<1)$ skewness_bernoulli(p);
                                   1 - 2 p
      (%o4)                  -------------------
                             sqrt(1 - p) sqrt(p)

Function: kurtosis_bernoulli (p)

  Returns the kurtosis coefficient of a Bernoulli(p) random variable, with 0<p<1.

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p), therefore when Maxima has not enough information to get the result, a noun form based on the binomial kurtosis coefficient is returned.

      (%i1) load (distrib)$
      (%i2) kurtosis_bernoulli(p);
      (%o2)                kurtosis_binomial(1, p)
      (%i3) assume(0<p,p<1)$ kurtosis_bernoulli(p);
                               1 - 6 (1 - p) p
      (%o4)                    ---------------
                                  (1 - p) p

Function: random_bernoulli (p)
Function: random_bernoulli (p, n)

  Returns a Bernoulli(p) random variate, with 0<p<1. Calling `random_bernoulli` with a second argument n, a random sample of size n will be simulated.

  This is a direct application of the `random` built-in Maxima function.

  See also `random`. To make use of this function, write first `load(distrib)`.

Function: pdf_geometric (x, p)

  Returns the value at x of the probability function of a Geometric(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: cdf_geometric (x, p)

  Returns the value at x of the distribution function of a Geometric(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: quantile_geometric (q, p)

  Returns the q-quantile of a Geometric(p) random variable, with 0<p<1; in other words, this is the inverse of `cdf_geometric`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_geometric (p)

  Returns the mean of a Geometric(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: var_geometric (p)

  Returns the variance of a Geometric(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: std_geometric (p)

  Returns the standard deviation of a Geometric(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: skewness_geometric (p)

  Returns the skewness coefficient of a Geometric(p) random variable, with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: kurtosis_geometric (p)

  Returns the kurtosis coefficient of a geometric random variable Geo(p), with 0<p<1. To make use of this function, write first `load(distrib)`.

Function: random_geometric (p)
Function: random_geometric (p, n)

  Returns a Geometric(p) random variate, with 0<p<1. Calling `random_geometric` with a second argument n, a random sample of size n will be simulated.

  The algorithm is based on simulation of Bernoulli trials.

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

Function: pdf_discrete_uniform (x, n)

  Returns the value at x of the probability function of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: cdf_discrete_uniform (x, n)

  Returns the value at x of the distribution function of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: quantile_discrete_uniform (q, n)

  Returns the q-quantile of a Discrete Uniform(n) random variable, with n a strictly positive integer; in other words, this is the inverse of `cdf_discrete_uniform`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_discrete_uniform (n)

  Returns the mean of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: var_discrete_uniform (n)

  Returns the variance of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: std_discrete_uniform (n)

  Returns the standard deviation of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: skewness_discrete_uniform (n)

  Returns the skewness coefficient of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: kurtosis_discrete_uniform (n)

  Returns the kurtosis coefficient of a Discrete Uniform(n) random variable, with n a strictly positive integer. To make use of this function, write first `load(distrib)`.

Function: random_discrete_uniform (n)
Function: random_discrete_uniform (n, m)

  Returns a Discrete Uniform(n) random variate, with n a strictly positive integer. Calling `random_discrete_uniform` with a second argument m, a random sample of size m will be simulated.

  This is a direct application of the `random` built-in Maxima function.

  See also `random`. To make use of this function, write first `load(distrib)`.

Function: pdf_hypergeometric (x, n1, n2, n)

  Returns the value at x of the probability function of a Hypergeometric(n1,n2,n) random variable, with n1, n2 and n non negative integers and n<=n1+n2. Being n1 the number of objects of class A, n2 the number of objects of class B, and n the size of the sample without replacement, this function returns the probability of event "exactly x objects are of class A".

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

Function: cdf_hypergeometric (x, n1, n2, n)

  Returns the value at x of the distribution function of a Hypergeometric(n1,n2,n) random variable, with n1, n2 and n non negative integers and n<=n1+n2. See `pdf_hypergeometric` for a more complete description.

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

Function: quantile_hypergeometric (q, n1, n2, n)

  Returns the q-quantile of a Hypergeometric(n1,n2,n) random variable, with n1, n2 and n non negative integers and n<=n1+n2; in other words, this is the inverse of `cdf_hypergeometric`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_hypergeometric (n1, n2, n)

  Returns the mean of a discrete uniform random variable Hyp(n1,n2,n), with n1, n2 and n non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)`.

Function: var_hypergeometric (n1, n2, n)

  Returns the variance of a hypergeometric random variable Hyp(n1,n2,n), with n1, n2 and n non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)`.

Function: std_hypergeometric (n1, n2, n)

  Returns the standard deviation of a Hypergeometric(n1,n2,n) random variable, with n1, n2 and n non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)`.

Function: skewness_hypergeometric (n1, n2, n)

  Returns the skewness coefficient of a Hypergeometric(n1,n2,n) random variable, with n1, n2 and n non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)`.

Function: kurtosis_hypergeometric (n1, n2, n)

  Returns the kurtosis coefficient of a Hypergeometric(n1,n2,n) random variable, with n1, n2 and n non negative integers and n<=n1+n2. To make use of this function, write first `load(distrib)`.

Function: random_hypergeometric (n1, n2, n)
Function: random_hypergeometric (n1, n2, n, m)

  Returns a Hypergeometric(n1,n2,n) random variate, with n1, n2 and n non negative integers and n<=n1+n2. Calling `random_hypergeometric` with a fourth argument m, a random sample of size m will be simulated.

  Algorithm described in Kachitvichyanukul, V., Schmeiser, B.W. (1985) Computer generation of hypergeometric random variates. Journal of Statistical Computation and Simulation 22, 127-145.

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

Function: pdf_negative_binomial (x, n, p)

  Returns the value at x of the probability function of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: cdf_negative_binomial (x, n, p)

  Returns the value at x of the distribution function of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer.

      (%i1) load (distrib)$
      (%i2) cdf_negative_binomial(3,4,1/8);
                                  3271
      (%o2)                      ------
                                 524288
      (%i3) float(%);
      (%o3)              .006238937377929687

Function: quantile_negative_binomial (q, n, p)

  Returns the q-quantile of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer; in other words, this is the inverse of `cdf_negative_binomial`. Argument q must be an element of [0,1]. To make use of this function, write first `load(distrib)`.

Function: mean_negative_binomial (n, p)

  Returns the mean of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: var_negative_binomial (n, p)

  Returns the variance of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: std_negative_binomial (n, p)

  Returns the standard deviation of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: skewness_negative_binomial (n, p)

  Returns the skewness coefficient of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: kurtosis_negative_binomial (n, p)

  Returns the kurtosis coefficient of a Negative Binomial(n,p) random variable, with 0<p<1 and n a positive integer. To make use of this function, write first `load(distrib)`.

Function: random_negative_binomial (n, p)
Function: random_negative_binomial (n, p, m)

  Returns a Negative Binomial(n,p) random variate, with 0<p<1 and n a positive integer. Calling `random_negative_binomial` with a third argument m, a random sample of size m will be simulated.

  Algorithm described in Devroye, L. (1986) Non-Uniform Random Variate Generation. Springer Verlag, p. 480.

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

[ << ] | [ >> ] |  |  |  |  |  | [Top] | [Contents] | [Index] | [ ? ]

This document was generated by Viktor T. Toth on September, 27 2018 using texi2html 1.76.