Bernoulli                package:Rlab                R Documentation

_T_h_e _B_e_r_n_o_u_l_l_i _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 Bernoulli distribution with parameter 'prob'.

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

     dbern(x, prob, log = FALSE)
     pbern(q, prob, lower.tail = TRUE, log.p = FALSE)
     qbern(p, prob, lower.tail = TRUE, log.p = FALSE)
     rbern(n, prob)

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

    x, q: vector of quantiles.

       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 on each trial.

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 Bernoulli distribution with 'prob' = p has density

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

     for x = 0 or 1.

     If an element of 'x' is not '0' or '1', the result of 'dbern' is
     zero, without a warning. p(x) is computed using Loader's
     algorithm, see the reference below.

     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:

     'dbern' gives the density, 'pbern' gives the distribution
     function, 'qbern' gives the quantile function and 'rbern'
     generates random deviates.

_R_e_f_e_r_e_n_c_e_s:

     Catherine Loader (2000). _Fast and Accurate Computation of
     Binomial Probabilities_; manuscript available from
     http://cm.bell-labs.com/cm/ms/departments/sia/catherine/dbinom

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

     'dbinom' for the binomial (Bernoulli is a special case of the
     binomial), and 'dpois' for the Poisson distribution.

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

     # Compute P(X=1) for X Bernoulli(0.7)
     dbern(1, 0.7)

