zanegbinomial(lp0="logit", lmunb = "loge", lk = "loge",
ep0=list(), emunb =list(), ek = list(), ipnb0 = NULL,
ik = NULL, zero = -3, cutoff = 0.995, method.init=1,
shrinkage.init=0.95)
p0
here.
See Links
for more choices.munb
parameter, which is the mean
$\mu_{nb}$ of an ordinary negative binomial distribution.
See Links
for more choices.k
. That is, as k
increases, the
variance of the response decreases.
See Links
for moearg
in Links
for general information.k
.
If given, they must be positive, and give one value
for each response/species.k
parameter
(after lk
is applied) for each responsp
in annegbinomial
."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-p_0) \mu_{nb} / [1 - (k/(k+\mu_{nb}))^k].$$
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.
For one response/species, by default, the three linear/additive predictors are $(logit(p_0), \log(\mu_{nb}), \log(k))^T$. This vector is recycled for multiple species.
dzanegbin
,
posnegbinomial
,
negbinomial
,
binomialff
,
rposnegbin
,
zinegbinomial
,
zipoisson
,
dnbinom
.x = runif(n <- 2000)
p0 = logit(-1 + 2*x, inverse=TRUE)
y1 = rposnegbin(n, munb=exp(0+2*x), size=exp(1)) # With covariates
y2 = rposnegbin(n, munb=exp(1+2*x), size=exp(1)) # With covariates
y1 = ifelse(runif(n) < p0, 0, y1)
y2 = ifelse(runif(n) < p0, 0, y2)
table(y1)
table(y2)
fit = vglm(cbind(y1,y2) ~ x, zanegbinomial, trace=TRUE)
coef(fit, matrix=TRUE)
fitted(fit)[1:3,]
predict(fit)[1:3,]
Run the code above in your browser using DataLab