Learn R Programming

VGAM (version 0.9-0)

zabinomial: Zero-Altered Binomial Distribution

Description

Fits a zero-altered binomial distribution based on a conditional model involving a Bernoulli distribution and a positive-binomial distribution.

Usage

zabinomial(lprob = "logit", lpobs0 = "logit",
           iprob = NULL,    ipobs0 = NULL,
           imethod = 1, zero = 2)

Arguments

lprob
Parameter link function applied to the probability parameter of the binomial distribution. See Links for more choices.
lpobs0
Link function for the parameter $p_0$, called pobs0 here. See Links for more choices.
iprob, ipobs0
imethod, zero

Value

  • 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-p_0) \mu_{b} / [1 - (1 - \mu_{b})^N]$$ where $\mu_{b}$ is the usual binomial mean.

Details

The response $Y$ is zero with probability $p_0$, else $Y$ has a positive-binomial distribution with probability $1-p_0$. Thus $0 < p_0 < 1$, which may be modelled as a function of the covariates. The zero-altered binomial distribution differs from the zero-inflated binomial distribution in that the former has zeros coming from one source, whereas the latter has zeros coming from the binomial distribution too. The zero-inflated binomial distribution is implemented in zibinomial. Some people call the zero-altered binomial a hurdle model.

The input is currently a vector or one-column matrix. Dy default, the two linear/additive predictors are $(\log(p), logit(p_0))^T$.

See Also

dzabinom, zibinomial, posbinomial, binomialff, dbinom, CommonVGAMffArguments.

Examples

Run this code
zdata <- data.frame(x2 = runif(nn <- 1000))
zdata <- transform(zdata,
                   size  = 10,
                   prob  = logit(-2 + 3*x2, inverse = TRUE),
                   pobs0 = logit(-1 + 2*x2, inverse = TRUE))
zdata <- transform(zdata,
                   y1 = rzabinom(nn, size = size, prob = prob, pobs0 = pobs0))
with(zdata, table(y1))

fit <- vglm(cbind(y1, size - y1) ~ x2, zabinomial(zero = NULL),
            zdata, trace = TRUE)
coef(fit, matrix = TRUE)
head(fitted(fit))
head(predict(fit))
summary(fit)

Run the code above in your browser using DataLab