Previous: Functions and Variables for continuous distributions, Up: distrib-pkg [Contents][Index]

### 52.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")`.

      (%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

  Categories:Package distrib ·

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.

      (%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

  Categories:Package distrib ·

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.

  Categories:Package distrib ·

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.

  Categories:Package distrib ·

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.

  Categories:Package distrib ·

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.

  Categories:Package distrib ·

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.

  Categories:Package distrib ·

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.

  Categories:Package distrib ·

Function: random_general_finite_discrete (v)
`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.

      (%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]

  Categories:Package distrib ·Random numbers ·

Function: pdf_binomial (x,n,p)

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

  Categories:Package 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 \leq p \leq 1 and n a positive integer.

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

  Categories:Package distrib ·

Function: quantile_binomial (q,n,p)

  Returns the q-quantile of a Binomial(n,p) random variable, with 0 \leq p \leq 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")`.

  Categories:Package distrib ·

Function: mean_binomial (n,p)

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

  Categories:Package distrib ·

Function: var_binomial (n,p)

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

  Categories:Package distrib ·

Function: std_binomial (n,p)

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

  Categories:Package distrib ·

Function: skewness_binomial (n,p)

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

  Categories:Package distrib ·

Function: kurtosis_binomial (n,p)

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

  Categories:Package distrib ·

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

  Returns a Binomial(n,p) random variate, with 0 \leq p \leq 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")`.

  Categories:Package distrib ·Random numbers ·

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")`.

  Categories:Package 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

  Categories:Package distrib ·

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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package distrib ·

Function: random_poisson (m)
`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")`.

  Categories:Package distrib ·Random numbers ·

Function: pdf_bernoulli (x,p)

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

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p).

      (%i1) load ("distrib")$
      (%i2) pdf_bernoulli(1,p);
      (%o2)                           p

  Categories:Package distrib ·

Function: cdf_bernoulli (x,p)

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

  Categories:Package distrib ·

Function: quantile_bernoulli (q,p)

  Returns the q-quantile of a Bernoulli(p) random variable, with 0 \leq p \leq 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")`.

  Categories:Package distrib ·

Function: mean_bernoulli (p)

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

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p).

      (%i1) load ("distrib")$
      (%i2) mean_bernoulli(p);
      (%o2)                           p

  Categories:Package distrib ·

Function: var_bernoulli (p)

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

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p).

      (%i1) load ("distrib")$
      (%i2) var_bernoulli(p);
      (%o2)                       (1 - p) p

  Categories:Package distrib ·

Function: std_bernoulli (p)

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

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p).

      (%i1) load ("distrib")$
      (%i2) std_bernoulli(p);
      (%o2)                           sqrt((1 - p) p)

  Categories:Package distrib ·

Function: skewness_bernoulli (p)

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

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p).

      (%i1) load ("distrib")$
      (%i2) skewness_bernoulli(p);
                                          1 - 2 p
      (%o2)                           ---------------
                                      sqrt((1 - p) p)

  Categories:Package distrib ·

Function: kurtosis_bernoulli (p)

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

  The Bernoulli(p) random variable is equivalent to the Binomial(1,p).

      (%i1) load ("distrib")$
      (%i2) kurtosis_bernoulli(p);
                               1 - 6 (1 - p) p
      (%o2)                    ---------------
                                  (1 - p) p

  Categories:Package distrib ·

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

  Returns a Bernoulli(p) random variate, with 0 \leq p \leq 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")`.

  Categories:Package distrib ·Random numbers ·

Function: pdf_geometric (x,p)

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

  The probability function is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package 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.

  The probability from which the distribution function is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package 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].

  The probability from which the quantile is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·

Function: mean_geometric (p)

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

  The probability from which the mean is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·

Function: var_geometric (p)

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

  The probability from which the variance is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·

Function: std_geometric (p)

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

  The probability from which the standard deviation is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·

Function: skewness_geometric (p)

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

  The probability from which the skewness is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·

Function: kurtosis_geometric (p)

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

  The probability from which the kurtosis is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·

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

  `random_geometric(p)` returns one random sample from a Geometric(p) distribution, with 0 < p <= 1.

  `random_geometric(p, n)` returns a list of n random samples.

  The algorithm is based on simulation of Bernoulli trials.

  The probability from which the random sample is derived is defined as p (1 - p)^x. This is interpreted as the probability of x failures before the first success.

  `load("distrib")` loads this function.

  Categories:Package distrib ·Random numbers ·

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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package distrib ·

Function: random_discrete_uniform (n)
`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")`.

  Categories:Package distrib ·Random numbers ·

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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package 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")`.

  Categories:Package distrib ·

Function: random_hypergeometric (n1,n2,n)
`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")`.

  Categories:Package distrib ·Random numbers ·

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 \leq 1 and n a positive number. To make use of this function, write first `load("distrib")`.

  Categories:Package 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 \leq 1 and n a positive number.

      (%i1) load ("distrib")$
      (%i2) cdf_negative_binomial(3,4,1/8);
                                  3271
      (%o2)                      ------
                                 524288

  Categories:Package distrib ·

Function: quantile_negative_binomial (q,n,p)

  Returns the q-quantile of a Negative Binomial(n,p) random variable, with 0 < p \leq 1 and n a positive number; 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")`.

  Categories:Package distrib ·

Function: mean_negative_binomial (n,p)

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

  Categories:Package distrib ·

Function: var_negative_binomial (n,p)

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

  Categories:Package distrib ·

Function: std_negative_binomial (n,p)

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

  Categories:Package distrib ·

Function: skewness_negative_binomial (n,p)

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

  Categories:Package distrib ·

Function: kurtosis_negative_binomial (n,p)

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

  Categories:Package distrib ·

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

  Returns a Negative Binomial(n,p) random variate, with 0 < p \leq 1 and n a positive number. 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")`.

  Categories:Package distrib ·Random numbers ·

Previous: Functions and Variables for continuous distributions, Up: distrib-pkg [Contents][Index]