zipoisson                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 _F_a_m_i_l_y _F_u_n_c_t_i_o_n

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

     Fits a zero-inflated Poisson distribution using full maximum
     likelihood estimation.

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

     zipoisson(lphi="logit", llambda = "loge", 
               ephi=list(), elambda =list(),
               iphi = NULL, method.init=1, shrinkage.init=0.8, zero = NULL)

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

    lphi: Link function for the parameter phi. See 'Links' for more
          choices.

 llambda: Link function for the usual lambda parameter. See 'Links' for
          more choices.

ephi, elambda: List. Extra argument for the respective links. See
          'earg' in 'Links' for general information.

    iphi: Optional initial value for phi, whose value must lie between
          0 and 1.  The default is to compute an initial value
          internally.

method.init: An integer with value '1' or '2' which specifies the
          initialization method for lambda. If failure to converge
          occurs try another value and/or else specify a value for
          'shrinkage.init' and/or else specify a value for 'iphi'.

shrinkage.init: How much shrinkage is used when initializing lambda.
          The value must be between 0 and 1 inclusive, and  a value of
          0 means the individual response values are used, and a value
          of 1 means the median or mean is used. This argument is used
          in conjunction with 'method.init'.

    zero: An integer specifying which linear/additive predictor is
          modelled as intercepts only.  If given, the value must be
          either 1 or 2, and the default is none of them. Setting
          'zero=1' makes phi a single parameter.

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

     This function uses Fisher scoring and is based on

               P(Y=0) =  phi + (1-phi) * exp(-lambda),

     and for y=1,2,...,

          P(Y=y) =  (1-phi) * exp(-lambda) * lambda^y / y!.

     The parameter phi satisfies 0 < phi < 1. The mean of Y is
     (1-phi)*lambda and these are returned as the fitted values.  By
     default, the two linear/additive predictors are (logit(phi),
     log(lambda))^T.

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

     An object of class '"vglmff"' (see 'vglmff-class'). The object is
     used by modelling functions such as 'vglm', and 'vgam'.

_W_a_r_n_i_n_g:

     Numerical problems can occur. Half-stepping is not uncommon. If
     failure to converge occurs, try using combinations of
     'method.init', 'shrinkage.init', 'iphi', and/or 'zero=1' if there
     are explanatory variables.

_N_o_t_e:

     For intercept-models, the 'misc' slot has a component called 'p0'
     which is the estimate of P(Y=0). Note that P(Y=0) is not the
     parameter phi.  This family function currently cannot handle a
     multivariate response.

     This family function is now recommended above 'yip88'.

     The zero-_deflated_ Poisson distribution cannot be handled with
     this family function. It can be handled with the zero-altered
     Poisson distribution; see 'zapoisson'.

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

     T. W. Yee

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

     Thas, O. and Rayner, J. C. W. (2005) Smooth tests for the
     zero-inflated Poisson distribution. _Biometrics_, *61*, 808-815.

     Data: Angers, J-F. and Biswas, A. (2003) A Bayesian analysis of
     zero-inflated generalized Poisson model. _Computational Statistics
     & Data Analysis_, *42*, 37-46.

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

     'zapoisson', 'Zipois', 'yip88', 'rpois'.

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

     x = runif(n <- 2000)
     phi = logit(-0.5 + 1*x, inverse=TRUE)
     lambda = loge(0.5 + 2*x, inverse=TRUE)
     y = rzipois(n, lambda, phi)
     table(y)
     fit = vglm(y ~ x, zipoisson, trace=TRUE)
     coef(fit, matrix=TRUE)  # These should agree with the above values

     # Another example: data from McKendrick (1926).
     y = 0:4  # Number of cholera cases per household in an Indian village
     w = c(168, 32, 16, 6, 1)  # Frequencies; there are 223=sum(w) households
     fit = vglm(y ~ 1, zipoisson, wei=w, trace=TRUE)
     coef(fit, matrix=TRUE)
     cbind(actual=w, fitted=
           dzipois(y, lambda=Coef(fit)[2], phi=Coef(fit)[1]) * sum(w))

     # Another example: data from Angers and Biswas (2003)
     y = 0:7
     w = c(182, 41, 12, 2, 2, 0, 0, 1)
     y = y[w>0]
     w = w[w>0]
     fit = vglm(y ~ 1, zipoisson(lphi=probit, iphi=0.3), wei=w, tra=TRUE)
     fit@misc$prob0  # Estimate of P(Y=0)
     coef(fit, matrix=TRUE)
     Coef(fit)  # Estimate of phi and lambda
     fitted(fit)
     weighted.mean(y,w) # Compare this with fitted(fit)
     summary(fit)

