
zipoisson(lphi="logit", llambda = "loge", ephi=list(), elambda =list(),
iphi = NULL, method.init=1, shrinkage.init=0.8, zero = NULL)
Links
for more choices.Links
for more choices.earg
in Links
for general information.1
or 2
which
specifies the initialization method for $\lambda$.
If failure to converge occurs try another value
and/or else specify a value for shrinkage.init
and/or else specify a valuezero=1
makes $\phi$
a single parameter."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as vglm
and vgam
.method.init
,
shrinkage.init
,
iphi
, and/or
zero=1
if there are explanatory variables.Data: Angers, J-F. and Biswas, A. (2003) A Bayesian analysis of zero-inflated generalized Poisson model. Computational Statistics & Data Analysis, 42, 37--46.
Cameron, A. C. and Trivedi, P. K. (1998) Regression Analysis of Count Data. Cambridge University Press: Cambridge.
zapoisson
,
Zipois
,
yip88
,
zipebcom
,
rpois
.zipdat = data.frame(x = runif(nn <- 2000))
zipdat = transform(zipdat, phi = logit(-0.5 + 1*x, inverse=TRUE),
lambda = loge( 0.5 + 2*x, inverse=TRUE))
zipdat = transform(zipdat, y = rzipois(nn, lambda, phi))
with(zipdat, table(y))
fit = vglm(y ~ x, zipoisson, zipdat, trace=TRUE)
coef(fit, matrix=TRUE) # These should agree with the above values
# Another example: McKendrick (1926). Data from 223 Indian village households
cholera = data.frame(ncases = 0:4, # Number of cholera cases,
wfreq = c(168, 32, 16, 6, 1)) # Frequencies
fit = vglm(ncases ~ 1, zipoisson, wei=wfreq, data=cholera, trace=TRUE)
coef(fit, matrix=TRUE)
with(cholera, cbind(actual=wfreq, fitted= round(
dzipois(ncases, lambda=Coef(fit)[2], phi=Coef(fit)[1]) * sum(wfreq), dig=2)))
# Another example: data from Angers and Biswas (2003)
abdat = data.frame(y = 0:7, w = c(182, 41, 12, 2, 2, 0, 0, 1))
abdat = subset(abdat, w>0)
fit = vglm(y ~ 1, zipoisson(lphi=probit, iphi=0.3), abdat, wei=w, trace=TRUE)
fit@misc$prob0 # Estimate of P(Y=0)
coef(fit, matrix=TRUE)
Coef(fit) # Estimate of phi and lambda
fitted(fit)
with(abdat, weighted.mean(y, w)) # Compare this with fitted(fit)
summary(fit)
Run the code above in your browser using DataLab