zigeometric {VGAM}R Documentation

Zero-Inflated Geometric Distribution Family Function

Description

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

Usage

zigeometric(lprob = "logit", eprob = list(),
            lpszero  = "logit", epszero  = list(),
            iprob = NULL, ipszero  = NULL,
            imethod = 1, bias.red = 0.5, zero = 2)

Arguments

lprob, lpszero

Link functions for the parameters prob and phi. The usual geometric probability parameter is the former. The probability of a structural zero is the latter. See Links for more choices.

eprob, epszero

List. Extra argument for the respective links. See earg in Links for general information.

bias.red

A constant used in the initialization process of pszero. It should lie between 0 and 1, with 1 having no effect.

iprob, ipszero

See CommonVGAMffArguments for information.

zero, imethod

See CommonVGAMffArguments for information.

Details

This function uses Fisher scoring and is based on

P(Y=0) = phi + (1-phi) * prob,

for y=0, and

P(Y=y) = (1-phi) * prob * (1 - prob)^y.

for y=1,2,…. The parameter phi satisfies 0 < phi < 1. The mean of Y is E(Y) = (1-phi) * prob / (1-prob) and these are returned as the fitted values. By default, the two linear/additive predictors are (logit(prob), logit(phi))^T.

Value

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

Warning

Numerical problems can occur. Half-stepping is not uncommon. If failure to converge occurs, make use of the argument ipszero.

Note

Numerical problems may occur since the initial values are currently not very good.

Author(s)

T. W. Yee

See Also

rzigeom, geometric, rgeom.

Examples

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, pszero = prob3),
                         y2 = rzigeom(nn, prob2, pszero = prob3),
                         y3 = rzigeom(nn, prob2, pszero = 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)

[Package VGAM version 0.8-4 Index]