
Fits a zero-altered binomial distribution based on a conditional model involving a Bernoulli distribution and a positive-binomial distribution.
zabinomial(lpobs0 = "logitlink", lprob = "logitlink",
type.fitted = c("mean", "prob", "pobs0"),
ipobs0 = NULL, iprob = NULL, imethod = 1, zero = NULL)
zabinomialff(lprob = "logitlink", lonempobs0 = "logitlink",
type.fitted = c("mean", "prob", "pobs0", "onempobs0"),
iprob = NULL, ionempobs0 = NULL, imethod = 1, zero = "onempobs0")
Parameter link function applied to the probability parameter
of the binomial distribution.
See Links
for more choices.
Link function for the parameter pobs0
here.
See Links
for more choices.
See CommonVGAMffArguments
and fittedvlm
for information.
Corresponding argument for the other parameterization. See details below.
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 type.fitted = "pobs0"
then
The response zibinomial
.
Some people call the zero-altered binomial a hurdle model.
The input is currently a vector or one-column matrix.
By default, the two linear/additive
predictors for zabinomial()
are
The VGAM family function zabinomialff()
has a few
changes compared to zabinomial()
.
These are:
(i) the order of the linear/additive predictors is switched so the
binomial probability comes first;
(ii) argument onempobs0
is now 1 minus the probability of an observed 0,
i.e., the probability of the positive binomial distribution,
i.e., onempobs0
is 1-pobs0
;
(iii) argument zero
has a new default so that the onempobs0
is intercept-only by default.
Now zabinomialff()
is generally recommended over
zabinomial()
.
Both functions implement Fisher scoring and neither can handle
multiple responses.
dzabinom
,
zibinomial
,
posbinomial
,
binomialff
,
dbinom
,
CommonVGAMffArguments
.
# NOT RUN {
zdata <- data.frame(x2 = runif(nn <- 1000))
zdata <- transform(zdata, size = 10,
prob = logitlink(-2 + 3*x2, inverse = TRUE),
pobs0 = logitlink(-1 + 2*x2, inverse = TRUE))
zdata <- transform(zdata,
y1 = rzabinom(nn, size = size, prob = prob, pobs0 = pobs0))
with(zdata, table(y1))
zfit <- vglm(cbind(y1, size - y1) ~ x2, zabinomial(zero = NULL),
data = zdata, trace = TRUE)
coef(zfit, matrix = TRUE)
head(fitted(zfit))
head(predict(zfit))
summary(zfit)
# }
Run the code above in your browser using DataLab