Maxima 5.47.0 Manual: Binomial Random Variable

Next: Poisson Random Variable, Previous: General Finite Discrete Random Variable, Up: Functions and Variables for discrete distributions [Contents][Index]

#### 52.3.2 Binomial Random Variable

The binomial distribution with parameters n and p is a discrete probability distribution. It consists of n independent experiments where each experiment consists of a Boolean-valued outcome where a success occurs with a probablity p.

For example, a biased coin that comes up heads with probablity p is tossed n times. Then the probability of exactly k heads in n tosses is given by the binomial distribution.

Function: pdf_binomial (x,n,p)

  Returns the value at x of the probability function of a \({\it 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")`.

  The pdf is $$ f(x; n, p) = {n\choose x} (1-p)^{n-x}p^x $$

  Categories:Package distrib ·

Function: cdf_binomial (x,n,p)

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

  The cdf is $$ F(x; n, p) = I_{1-p}(n-\lfloor x \rfloor, \lfloor x \rfloor + 1) $$

  where \(I_z(a,b)\) is the beta_incomplete_regularized function.

      (%i1) load ("distrib")$

      (%i2) cdf_binomial(5,7,1/6);
                                    7775
      (%o2)                         ----
                                    7776

      (%i3) float(%);
      (%o3)                  0.9998713991769548

  Categories:Package distrib ·

Function: quantile_binomial (q,n,p)

  Returns the q-quantile of a \({\it 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 \({\it 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")`.

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

  Categories:Package distrib ·

Function: var_binomial (n,p)

  Returns the variance of a \({\it 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")`.

  The variance is $$ V[X] = np(1-p) $$

  Categories:Package distrib ·

Function: std_binomial (n,p)

  Returns the standard deviation of a \({\it 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")`.

  The standard deviation is $$ D[X] = \sqrt{np(1-p)} $$

  Categories:Package distrib ·

Function: skewness_binomial (n,p)

  Returns the skewness coefficient of a \({\it 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")`.

  The skewness coefficient is $$ SK[X] = {1-2p\over \sqrt{np(1-p)}} $$

  Categories:Package distrib ·

Function: kurtosis_binomial (n,p)

  Returns the kurtosis coefficient of a \({\it 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")`.

  The kurtosis coefficient is $$ KU[X] = {1-6p(1-p)\over np(1-p)} $$

  Categories:Package distrib ·

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

  Returns a \({\it 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 ·

Next: Poisson Random Variable, Previous: General Finite Discrete Random Variable, Up: Functions and Variables for discrete distributions [Contents][Index]