Learn R Programming

VGAM (version 0.9-1)

zageometric: Zero-Altered Geometric Distribution

Description

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

Usage

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

Arguments

lpobs0
Link function for the parameter $p_0$ or $\phi$, called pobs0 or phi here. See Links for more choices.
lprob
Parameter link function applied to the probability of success, called prob or $p$. See Links for more choices.
ipobs0, iprob
Optional initial values for the parameters. If given, they must be in range. For multi-column responses, these are recycled sideways.
zero, imethod

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-\phi) / p.$$

Warning

Convergence for this VGAM family function seems to depend quite strongly on providing good initial values.

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.

Details

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

The input can be a matrix (multiple responses). By default, the two linear/additive predictors are $(\log(\phi), logit(p))^T$.

See Also

dzageom, geometric, zigeometric, dgeom, CommonVGAMffArguments.

Examples

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

fit <- vglm(cbind(y1, y2) ~ x2, zageometric, zdata, trace = TRUE)
coef(fit, matrix = TRUE)
head(fitted(fit))
head(predict(fit))
summary(fit)

Run the code above in your browser using DataLab