Learn R Programming

MXM (version 0.9.7)

Zero inflated Poisson regression: Zero inflated Poisson regression

Description

Zero inflated Poisson regression.

Usage

zip.mod(target, dataset, wei = NULL, xnew = NULL) zip.reg(target, dataset, wei = NULL, lgy = NULL)

Arguments

target
The target (dependent) variable. It must be a numerical vector with integers.
dataset
The indendent variable(s). It can be a vector, a matrix or a dataframe with continuous only variables, a data frame with mixed or only categorical variables.
wei
A vector of weights to be used for weighted regression. The default value is NULL.
xnew
If you have new values for the predictor variables (dataset) whose target variable you want to predict insert them here. If you put the "dataset" or leave it NULL it will calculate the regression fitted values.
lgy
If you have already calculated the constant term of the ZIP regression plug it here. This is the sum of the logarithm of the factorial of the values.

Value

A list including: A list including:

Details

The zero inflated Poisson regression as suggested by Lambert (1992) is fitted. Unless you have a sufficient number of zeros, there is no reason to use this model. The "zip.reg" is an internal wrapper function and is used for speed up purposes. It is not to be called directly by the user unless they know what they are doing.

References

Lambert D. (1992). Zero-inflated Poisson regression, with an application to defects in manufacturing. Technometrics, 34(1):1-14.

See Also

testIndZIP, zip.regs, reg.fit, ridge.reg

Examples

Run this code
y <- rpois(100, 2)
x <- matrix( rnorm(100 * 2), ncol = 2)
a1 <- glm(y ~ x, poisson)
a2 <- zip.mod(y, x) 
summary(a1)
logLik(a1)
a2  ## a ZIP is not really necessary
y[1:20] <- 0
a1 <- glm(y ~ x, poisson)
a2 <- zip.mod(y, x) 
summary(a1)
logLik(a1)
a2  ## a ZIP is probably more necessary

Run the code above in your browser using DataLab