rposnegbin               package:VGAM               R Documentation

_P_o_s_i_t_i_v_e-_n_e_g_a_t_i_v_e _b_i_n_o_m_i_a_l _d_i_s_t_r_i_b_u_t_i_o_n _r_a_n_d_o_m _v_a_r_i_a_t_e_s

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

     Generate random variates from a positive-negative binomial
     distribution.

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

     rposnegbin(n, munb, k)

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

       n: number of random values to return.

    munb: vector of positive means (of an ordinary negative binomial
          distribution).

       k: vector of positive index parameters (of an ordinary negative
          binomial distribution). This is called the 'size' argument in
          'rnbinom'.

          Short vectors are recycled. The  parameter '1/k' is known as
          a dispersion parameter; as 'k' approaches infinity, the
          negative binomial distribution approaches a Poisson
          distribution.

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

     The positive-negative binomial distribution is a negative binomial
     distribution but with the probability of a zero being zero. The
     other probabilities are scaled to add to unity. The mean therefore
     is

                           munb / (1-p(0))

     where munb the mean of an ordinary negative binomial distribution.
     The arguments of the function are fed into 'rnbinom' until n
     positive values are obtained.

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

     n random deviates are returned.

_N_o_t_e:

     The running time is slow when 'munb' is very close to zero.

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

     T. W. Yee

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

     Welsh, A. H., Cunningham, R. B., Donnelly, C. F. and Lindenmayer,
     D. B. (1996) Modelling the abundances of rare species: statistical
     models for counts with extra zeros. _Ecological Modelling_, *88*,
     297-308.

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

     'rnbinom', 'posnegbinomial', 'zanegbinomial'.

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

     munb = 2; k = 4; n = 1000
     y = rposnegbin(n, munb=munb, k=k)
     table(y)
     mean(y)    # sample mean
     munb / (1 - (k/(k+munb))^k) # population mean

