

rnegbin(MASS)                                R Documentation

_S_i_m_u_l_a_t_e _N_e_g_a_t_i_v_e _B_i_n_o_m_i_a_l _V_a_r_i_a_t_e_s

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

     Function to generate random outcomes from a Negative
     Binomial distribution, with mean `mu' and variance `mu
     + mu^2/theta'.

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

     rnegbin(n, mu=n, theta=stop("theta must be given"))

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

       n: If a scalar, the number of sample values required.
          If a vector, `length(n)' is the number required
          and `n' is used as the mean vector if `mu' is not
          specified.

      mu: The vector of means.  Short vectors are recycled.

   theta: Vector of values of the `theta' parameter.  Short
          vectors are recycled.

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

     The function uses the representation of the Negative
     Binomial distribution as a continuous mixture of Pois-
     son distributions with Gamma distributed means.  Unlike
     `rnbinom' the index can be arbitrary.

_V_a_l_u_e_:

     Vector of random Negative Binomial variate values.

_S_i_d_e _E_f_f_e_c_t_s_:

     Changes `.Random.seed' in the usual way.

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

     # Negative Binomials with means fitted(fm) and theta=4.5
     data(quine)
     fm <- glm.nb(Days ~ ., data=quine)
     dummy <- rnegbin(fitted(fm), theta=4.5)

