Learn R Programming

cplm (version 0.7-8)

zcpglm: Zero-inflated Compound Poisson Generalized Linear Models

Description

This function fits zero-inflated compound Poisson generalized linear models.

Usage

zcpglm(formula, link = "log", data, weights, offset, 
      subset, na.action = NULL, contrasts = NULL, 
      control = list(), optimizer = "nlminb")

Arguments

formula

an object of class formula. See details below.

link

a specification for the compound Poisson model link function. See cpglm. For the zero-inflation model, the logit link is used.

data, subset, na.action, contrasts, control

see cpglm for details.

weights, offset

prior weights and offset. If specified, they will be used in both the zero-inflation and the compound Poisson model. See details below for specifying different offsets for each model.

optimizer

a character string that determines which optimization routine is to be used. Possible choices are "nlminb" (the default, see nlminb), "bobyqa" (bobyqa) and "L-BFGS-B" (optim).

Value

zcpglm returns an object of class "zcpglm". See zcpglm-class for details of the return values as well as various methods available for this class.

Details

This function implements zero-inflated compound Poisson generalized linear models. This is similar to the zero-inflated Poisson model for count data, with the Poisson distribution replaced by the compound Poisson distribution. Specifically, the observation is allowed to com from a degenerate distribution at zero with a positive probability, in addition to the regular compound Poisson process. This latent zero-inflation part is specified using a logistic regression structure, while the compound Poisson component is modeled the same as in cpglm. Parameters are estimated by maximizing the marginal likelihood, and the variance-covariance matrix is computed numerically.

The formula specification is similar to that in zeroinfl (package pscl) except that we use || instead of | to separate the two parts of the model. For example, the formula y ~ x1 + x2 || 1 indicates that y ~ x1 + x2 is used for the compound Poison part and ~ 1 for the zero-inflation part. If the inflation part is omitted, it defaults to a model with an intercept. Offsets can be specified in both components of the model, e.g., y ~ x1 + offset(x2) | z1 + z2 + offset(z3).

More details of this model are available in the package vignettes.

See Also

The users are recommended to see the documentation for zcpglm-class, cpglm and zeroinfl for related information.

Examples

Run this code
# NOT RUN {
da <- subset(AutoClaim, IN_YY == 1) # use data in the Yip and Yau paper
da <- transform(da, CLM_AMT5 = CLM_AMT5/1000,
                 INCOME = INCOME/10000)
(Z0 <- zcpglm(CLM_AMT5 ~ CAR_USE + MARRIED + AREA + MVR_PTS||
             MVR_PTS + INCOME, data = da))

# }

Run the code above in your browser using DataLab