#### 52.3.5 Geometric Random Variable

The Geometric distibution is a discrete probability distribution. It is the distribution of the number Bernoulli trials that fail before the first success.

Consider flipping a biased coin where heads occurs with probablity p. Then the probability of k-1 tails in a row followed by heads is given by the \({\it Geometric}(p)\) distribution.

Function: pdf_geometric (x,p)

  Returns the value at x of the probability function of a \({\it Geometric}(p)\) random variable, with 0 < p \leq 1

  The pdf is $$ f(x; p) = 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 \({\it Geometric}(p)\) random variable, with 0 < p \leq 1

  The cdf is $$ 1-(1-p)^{1 + \lfloor x \rfloor} $$

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

  Categories:Package distrib ·

Function: quantile_geometric (q,p)

  Returns the q-quantile of a \({\it 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 \({\it Geometric}(p)\) random variable, with 0 < p \leq 1.

  The mean is $$ E[X] = {1\over 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 \({\it Geometric}(p)\) random variable, with 0 < p \leq 1.

  The variance is $$ V[X] = {1-p\over p^2} $$

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

  Categories:Package distrib ·

Function: std_geometric (p)

  Returns the standard deviation of a \({\it Geometric}(p)\) random variable, with 0 < p \leq 1.

  $$ D[X] = {\sqrt{1-p} \over p} $$

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

  Categories:Package distrib ·

Function: skewness_geometric (p)

  Returns the skewness coefficient of a \({\it Geometric}(p)\) random variable, with 0 < p \leq 1.

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

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

  Categories:Package distrib ·

Function: kurtosis_geometric (p)

  Returns the kurtosis coefficient of a geometric random variable \({\it Geometric}(p)\), with 0 < p \leq 1.

  The kurtosis coefficient is $$ KU[X] = {p^2-6p+6 \over 1-p} $$

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