Learn R Programming

VGAM (version 0.8-7)

zigeometric: Zero-Inflated Geometric Distribution Family Function

Description

Fits a zero-inflated geometric distribution by maximum likelihood estimation.

Usage

zigeometric(lprob = "logit", eprob = list(),
            lpstr0  = "logit", epstr0  = list(),
            iprob = NULL, ipstr0  = NULL,
            imethod = 1, bias.red = 0.5, zero = 2)

Arguments

lprob, lpstr0
Link functions for the parameters $p$ (prob) and $\phi$. The usual geometric probability parameter is the former. The probability of a structural zero is the latter. See Links for more ch
eprob, epstr0
List. Extra argument for the respective links. See earg in Links for general information.
bias.red
A constant used in the initialization process of pstr0. It should lie between 0 and 1, with 1 having no effect.
iprob, ipstr0
See CommonVGAMffArguments for information.
zero, imethod
See CommonVGAMffArguments for information.

Value

  • An object of class "vglmff" (see vglmff-class). The object is used by modelling functions such as vglm and vgam.

Details

This function uses Fisher scoring and is based on $$P(Y=0) = \phi + (1-\phi) p,$$ for $y=0$, and $$P(Y=y) = (1-\phi) p (1 - p)^{y}.$$ for $y=1,2,\ldots$. The parameter $\phi$ satisfies $0 < \phi < 1$. The mean of $Y$ is $E(Y)=(1-\phi) p / (1-p)$ and these are returned as the fitted values. By default, the two linear/additive predictors are $(logit(p), logit(\phi))^T$.

See Also

rzigeom, geometric, zageometric, rgeom.

Examples

Run this code
gdata = data.frame(x2 = runif(nn <- 1000) - 0.5)
gdata = transform(gdata, x3 = runif(nn) - 0.5,
                         x4 = runif(nn) - 0.5)
gdata = transform(gdata, eta1 =  1.0 - 1.0 * x2 + 2.0 * x3,
                         eta2 = -1.0,
                         eta3 =  0.5)
gdata = transform(gdata, prob1 = logit(eta1, inverse = TRUE),
                         prob2 = logit(eta2, inverse = TRUE),
                         prob3 = logit(eta3, inverse = TRUE))
gdata = transform(gdata, y1 = rzigeom(nn, prob1, pstr0 = prob3),
                         y2 = rzigeom(nn, prob2, pstr0 = prob3),
                         y3 = rzigeom(nn, prob2, pstr0 = prob3))
with(gdata, table(y1))
with(gdata, table(y2))
with(gdata, table(y3))
head(gdata)

fit1 = vglm(y1 ~ x2 + x3 + x4, zigeometric, gdata, trace = TRUE)
coef(fit1, matrix = TRUE)

fit2 = vglm(y2 ~ 1, zigeometric, gdata, trace = TRUE)
coef(fit2, matrix = TRUE)

fit3 = vglm(y3 ~ 1, zigeometric, gdata, trace = TRUE)
coef(fit3, matrix = TRUE)
summary(fit3)

Run the code above in your browser using DataLab