Zipois                 package:VGAM                 R Documentation

_Z_e_r_o-_I_n_f_l_a_t_e_d _P_o_i_s_s_o_n _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-inflated Poisson distribution with
     parameter 'phi'.

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

     dzipois(x, lambda, phi = 0)
     pzipois(q, lambda, phi = 0)
     qzipois(p, lambda, phi = 0)
     rzipois(n, lambda, phi = 0)

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

    x, q: vector of quantiles.

       p: vector of probabilities.

       n: number of observations. Must be a single positive integer. 

  lambda: Vector of positive means. 

     phi: Probability of zero (ignoring the Poisson distribution),
          called phi.  The default value of phi=0 corresponds to the
          response having an ordinary Poisson distribution.

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

     The probability function of Y is 0 with probability phi, and
     Poisson(lambda) with probability 1-phi. Thus 

                   P(Y=0) = phi + (1-phi) * P(W=0)

     where W is distributed Poisson(lambda).

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

     'dzipois' gives the density, 'pzipois' gives the distribution
     function, 'qzipois' gives the quantile function, and 'rzipois'
     generates random deviates.

_N_o_t_e:

     The argument 'phi' 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:

     'dpois', 'zipoisson'.

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

     lambda = 4
     phi = 0.8
     (i = dzipois(0:7, lambda, phi))
     cumsum(i) - pzipois(0:7, lambda, phi)  # Should be 0s
     table(rzipois(100, lambda, phi))

     table(qzipois(runif(100), lambda, phi))
     round(dzipois(0:10, lambda, phi) * 100) # Should be similar

     ## Not run: 
     x = 0:10
     plot(x, dzipois(x, lambda, phi), type="h", ylab="Probability", 
          main=paste("ZIP(", lambda, ", phi=", phi, ") (blue) vs",
          " Poisson(", lambda, ") (red & shifted slightly)", sep=""),
          lwd=2, col="blue", las=1)
     lines(x+0.05, dpois(x, lambda), type="h", lwd=2, col="red")
     ## End(Not run)

