rvbinom                  package:rv                  R Documentation

_G_e_n_e_r_a_t_e _R_a_n_d_o_m _V_a_r_i_a_b_l_e_s _f_r_o_m _a _B_i_n_o_m_i_a_l _S_a_m_p_l_i_n_g _M_o_d_e_l

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

     Generates a random vector from a binomial sampling model.

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

       rvbinom(n=1, size, prob)

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

       n: integer, number of random variables to generate

    size: integer or integer-valued rv: the number of trials (size of
          each sample)

    prob: prior probability of success of each trial (may be constant
          or an rv object)

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

     'rvbinom' generates a random vector with given length,  the
     distribution for size and the distribution for the probability of
     success.

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

_A_u_t_h_o_r(_s):

     Jouni Kerman kerman@stat.columbia.edu <URL:
     http://www.stat.columbia.edu/~kerman>

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

     Kerman, Jouni and Gelman, Andrew. Manipulating and Summarizing
     Posterior Simulations Using Random Variable Objects. Technical
     report, Columbia University, New York.

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

       s <- 1+rvpois(1,lambda=3)        # A prior distribution on the 'size' parameter.
       rvbinom(1, size=s, prob=0.5)     # The 'size' is random.
       p <- rvbinom(1, 10, prob=0.5)/10 # Prior probability of success.
       rvbinom(1, size=10, prob=p)      # Now the probability is random.
       rvbinom(1, size=s, prob=p)       # Both the size and the probability are random.

