

   Geometric {base}                             R Documentation

   TThhee GGeeoommeettrriicc DDiissttrriibbuuttiioonn

   DDeessccrriippttiioon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Ussaaggee::

        dgeom(x, prob)
        pgeom(q, prob)
        qgeom(p, prob)
        rgeom(n, prob)

   AArrgguummeenntts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Deettaaiills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Seeee AAllssoo::

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

   EExxaammppllees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)))

