zigeometric {VGAM} | R Documentation |
Fits a zero-inflated geometric distribution by maximum likelihood estimation.
zigeometric(lprob = "logit", eprob = list(), lpszero = "logit", epszero = list(), iprob = NULL, ipszero = NULL, imethod = 1, bias.red = 0.5, zero = 2)
lprob, lpszero |
Link functions for the parameters |
eprob, epszero |
List. Extra argument for the respective links.
See |
bias.red |
A constant used in the initialization process of |
iprob, ipszero |
See |
zero, imethod |
See |
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.
An object of class "vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.
Numerical problems can occur.
Half-stepping is not uncommon.
If failure to converge occurs, make use of the argument ipszero
.
Numerical problems may occur since the initial values are currently not very good.
T. W. Yee
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)