Geometric               package:stats               R Documentation

_T_h_e _G_e_o_m_e_t_r_i_c _D_i_s_t_r_i_b_u_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     Density, distribution function, quantile function and random
     generation for the geometric distribution with parameter 'prob'.

_U_s_a_g_e:

     dgeom(x, prob, log = FALSE)
     pgeom(q, prob, lower.tail = TRUE, log.p = FALSE)
     qgeom(p, prob, lower.tail = TRUE, log.p = FALSE)
     rgeom(n, prob)

_A_r_g_u_m_e_n_t_s:

    x, q: vector of quantiles representing the number of failures in a
          sequence of Bernoulli trials before success occurs.

       p: vector of probabilities.

       n: number of observations. If 'length(n) > 1', the length is
          taken to be the number required.

    prob: probability of success in each trial. '0 < prob <= 1'.

log, log.p: logical; if TRUE, probabilities p are given as log(p).

lower.tail: logical; if TRUE (default), probabilities are P[X <= x],
          otherwise, P[X > x].

_D_e_t_a_i_l_s:

     The geometric distribution with 'prob' = p has density

                           p(x) = p (1-p)^x

     for x = 0, 1, 2, ..., 0 < p <= 1.

     If an element of 'x' is not integer, the result of 'pgeom' is
     zero, with a warning.

     The quantile is defined as the smallest value x such that F(x) >=
     p, where F is the distribution function.

_V_a_l_u_e:

     'dgeom' gives the density, 'pgeom' gives the distribution
     function, 'qgeom' gives the quantile function, and 'rgeom'
     generates random deviates.

     Invalid 'prob' will result in return value 'NaN', with a warning.

_S_o_u_r_c_e:

     'dgeom' computes via 'dbinom', using code contributed by Catherine
     Loader (see 'dbinom').

     'pgeom' and 'qgeom' are based on the closed-form formulae.

     'rgeom' uses the derivation as an exponential mixture of Poissons,
     see

     Devroye, L. (1986) _Non-Uniform Random Variate Generation._
     Springer-Verlag, New York. Page 480.

_S_e_e _A_l_s_o:

     'dnbinom' for the negative binomial which generalizes the
     geometric distribution.

_E_x_a_m_p_l_e_s:

     qgeom((1:9)/10, prob = .2)
     Ni <- rgeom(20, prob = 1/4); table(factor(Ni, 0:max(Ni)))

