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)))