Zanegbin                package:VGAM                R Documentation

_Z_e_r_o-_A_l_t_e_r_e_d _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

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

     Density, distribution function, quantile function and random
     generation for the zero-altered negative binomial distribution
     with parameter 'p0'.

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

     dzanegbin(x, p0, size, prob=NULL, munb=NULL, log = FALSE)
     pzanegbin(q, p0, size, prob=NULL, munb=NULL)
     qzanegbin(p, p0, size, prob=NULL, munb=NULL)
     rzanegbin(n, p0, size, prob=NULL, munb=NULL)

_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' then the length
          is taken to be the number required. 

size, prob, munb, log: Parameters from the ordinary negative binomial
          distribution (see 'dnbinom'). Some arguments have been
          renamed slightly.

      p0: Probability of zero, called p0. The default value of 'p0=0'
          corresponds to the response having a positive negative
          binomial distribution.

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

     The probability function of Y is 0 with probability 'p0', else a
     positive negative binomial(munb, size) distribution.

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

     'dzanegbin' gives the density and 'pzanegbin' gives the
     distribution function, 'qzanegbin' gives the quantile function,
     and 'rzanegbin' generates random deviates.

_N_o_t_e:

     The argument 'p0' is recycled to the required length, and must
     have values which lie in the interval [0,1].

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

     Thomas W. Yee

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

     'zanegbinomial', 'rposnegbin'.

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

     munb = 3; size = 4; p0 = 0.3
     x = (-1):7
     (ii = dzanegbin(x, p0=p0, munb=munb, size=size))
     table(rzanegbin(100, p0=p0, munb=munb, size=size))

     ## Not run: 
     x = 0:10
     barplot(rbind(dzanegbin(x, p0=p0, munb=munb, size=size),
                   dnbinom(x, mu=munb, size=size)),
             beside = TRUE, col = c("blue","green"),
             main=paste("ZANB(p0=", p0, ", munb=", munb, ", size=", size, ") (blue) vs",
                             " NB(mu=", munb, ", size=", size, ") (green)", sep=""),
             names.arg = as.character(x), cex.main=0.7, las=1)
     ## End(Not run)

