zinegbinomial              package:VGAM              R Documentation

_Z_e_r_o-_I_n_f_l_a_t_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 _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 negative binomial distribution by full
     maximum likelihood estimation.

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

     zinegbinomial(lphi="logit", lmunb = "loge", lk = "loge",
                   ephi=list(), emunb =list(), ek = list(),
                   iphi = NULL, ik = NULL, zero = -3, method.init=1,
                   shrinkage.init=0.95, nsimEIM=200)

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

lphi, lmunb, lk: Link functions for the parameters phi, the mean and k;
          see 'negbinomial' for details, and 'Links' for more choices.

ephi, emunb, ek: List. Extra arguments for the respective links. See
          'earg' in 'Links' for general information.

iphi, ik: Optional initial values for phi and k. The default is to
          compute an initial value internally for both.

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

shrinkage.init: How much shrinkage is used when initializing the mean.
          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: Integers specifying which linear/additive predictor is
          modelled as intercepts only.  If given, their absolute values
          must be either 1 or 2 or 3, and the default is only the k
          parameters (one for each response). See
          'CommonVGAMffArguments' for more information.

 nsimEIM: See 'CommonVGAMffArguments' for more information.

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

     This function uses simulation and Fisher scoring, and is based on

               P(Y=0) =  phi + (1-phi) * (k/(k+mu))^k,

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

                P(Y=y) =  (1-phi) * dnbinom(y, mu, k).

     The parameter phi satisfies 0 < phi < 1. The mean of Y is
     (1-phi)*munb (returned as the fitted values).  By default, the
     three linear/additive predictors are (logit(phi), log(munb),
     log(k))^T. See 'negbinomial', another 'VGAM' family function, for
     the formula of the probability density function and other details
     of the negative binomial distribution.

     Independent multivariate responses are handled. If so then
     arguments 'iphi' and 'ik' may be vectors with length equal to the
     number of responses.

_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, e.g., when the probability of zero
     is actually less than, not more than, the nominal probability of
     zero. Half-stepping is not uncommon. If failure to converge
     occurs, try using combinations of 'method.init', 'shrinkage.init',
     'iphi', 'ik', and/or 'zero' 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.

     If k is large then the use of 'VGAM' family function 'zipoisson'
     is probably preferable. This follows because the Poisson is the
     limiting distribution of a negative binomial as k tends to
     infinity.

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

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

     T. W. Yee

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

     'Zinegbin', 'negbinomial', 'rpois'.

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

     x = runif(n <- 1000)
     phi = logit(-0.5+1*x, inverse=TRUE)
     munb = exp(3+x)
     k = exp(0+2*x)
     y1 = rzinegbin(n, phi, mu=munb, size=k)
     y2 = rzinegbin(n, phi, mu=munb, size=k)
     table(y1)["0"] / sum(table(y1))
     table(y2)["0"] / sum(table(y2))
     fit = vglm(cbind(y1,y2) ~ x, zinegbinomial(zero=NULL), trace=TRUE)
     coef(fit, matrix=TRUE)
     summary(fit)
     head(cbind(fitted(fit), (1-phi) * munb))
     vcov(fit)

