

Geometric {base}                             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_:

     These functions provide information about the geometric
     distribution with parameter `prob'.  `dgeom' gives the
     density, `pgeom' gives the distribution function,
     `qgeom' gives the quantile function, and `rgeom' gener-
     ates random deviates.

_U_s_a_g_e_:

     dgeom(x, prob)
     pgeom(q, prob)
     qgeom(p, prob)
     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 to generate.

    prob: probability of success in each trial.

_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, ...

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

     The quantile is left continuous: `qgeom(q, prob)' is
     the largest integer x such that P(X <= x) < q.

_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_:

     pp <- sort(c((1:9)/10, 1 - .2^(2:8)))
     print(qg <- qgeom(pp, prob = .2))
     ## test that qgeom is an inverse of pgeom
     print(qg1 <- qgeom(pgeom(qg, prob=.2), prob =.2))
     all(qg == qg1)
     Ni <- rgeom(20, prob = 1/4); table(factor(Ni, 0:max(Ni)))

