| zanegbinomial {VGAM} | R Documentation |
Fits a zero-altered negative binomial distribution based on a conditional model involving a binomial distribution and a positive-negative binomial distribution.
zanegbinomial(lpobs0 = "logit", lmunb = "loge", lsize = "loge",
ipobs0 = NULL, isize = NULL,
zero = c(-1, -3), imethod = 1,
nsimEIM = 250, shrinkage.init = 0.95)
lpobs0 |
Link function for the parameter pobs0, called |
lmunb |
Link function applied to the |
lsize |
Parameter link function applied to the reciprocal of the dispersion
parameter, called |
ipobs0, isize |
Optional initial values for pobs0 and |
zero |
Integer valued vector, may be assigned, e.g., -3 or 3 if
the probability of an observed value is to be modelled with the
covariates.
Specifies which of the three linear predictors are
modelled as an intercept only. By default, the |
nsimEIM, imethod |
|
shrinkage.init |
See |
The response Y is zero with probability pobs0, or Y has a positive-negative binomial distribution with probability 1-pobs0. Thus 0 < pobs0 < 1, which is modelled as a function of the covariates. The zero-altered negative binomial distribution differs from the zero-inflated negative binomial distribution in that the former has zeros coming from one source, whereas the latter has zeros coming from the negative binomial distribution too. The zero-inflated negative binomial distribution is implemented in the VGAM package. Some people call the zero-altered negative binomial a hurdle model.
For one response/species, by default, the three linear/additive predictors are (logit(pobs0), log(munb), log(k))^T. This vector is recycled for multiple species.
An object of class "vglmff" (see vglmff-class).
The object is used by modelling functions such as vglm,
and vgam.
The fitted.values slot of the fitted object,
which should be extracted by the generic function fitted, returns
the mean mu which is given by
mu = (1-pobs0) * munb / [1 - (k/(k+munb))^k].
Convergence for this VGAM family function seems to depend quite strongly on providing good initial values.
This VGAM family function is computationally expensive
and usually runs slowly;
setting trace = TRUE is useful for monitoring convergence.
Inference obtained from summary.vglm and summary.vgam
may or may not be correct. In particular, the p-values, standard errors
and degrees of freedom may need adjustment. Use simulation on artificial
data to check that these are reasonable.
Note this family function allows pobs0 to be modelled as
functions of the covariates provided zero is set correctly.
It is a conditional model, not a mixture model.
Simulated Fisher scoring is the algorithm.
This family function effectively combines
binomialff into
one family function.
This family function can handle a multivariate response, e.g., more than one species.
T. W. Yee
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.
dzanegbin,
posnegbinomial,
negbinomial,
binomialff,
rposnegbin,
zinegbinomial,
zipoisson,
dnbinom,
CommonVGAMffArguments.
## Not run:
zdata <- data.frame(x2 = runif(nn <- 2000))
zdata <- transform(zdata, pobs0 = logit(-1 + 2*x2, inverse = TRUE))
zdata <- transform(zdata,
y1 = rzanegbin(nn, munb = exp(0+2*x2), size = exp(1), pobs0 = pobs0),
y2 = rzanegbin(nn, munb = exp(1+2*x2), size = exp(1), pobs0 = pobs0))
with(zdata, table(y1))
with(zdata, table(y2))
fit <- vglm(cbind(y1, y2) ~ x2, zanegbinomial, zdata, trace = TRUE)
coef(fit, matrix = TRUE)
head(fitted(fit))
head(predict(fit))
## End(Not run)