VGAM (version 1.1-1)

genipoisson: Generally-Inflated Poisson Distribution Family Function

Description

Fits a generally-inflated Poisson distribution based on a mixture model involving a multinomial distribution and a Poisson distribution.

Usage

genipoisson(inflate = 0, zero = NULL, llambda = "loglink",
           type.fitted = c("mean", "lambda", "pstr.i", "onempstr.i"),
           imethod = 1, mux.inflate = 0.5, ipstr0 = NULL,
           ilambda = NULL, ishrinkage = 0.95, probs.y = 0.35)

Arguments

inflate

Vector of inflated values, i.e., nonnegative integers. Must have unique values only. May be a NULL, which stands for empty set (same as poissonff). The default is the 0-inflated Poisson. See below for recommendations of its use.

llambda

See Links for more choices and information.

type.fitted

See CommonVGAMffArguments for information. The choice "pstr.i" is the sum of the structural probabilities and "onempstr.i" is its complement.

mux.inflate

Numeric, between 0 and 1. For the initial values of the multinomial probabilities, the sample proportions are multiplied by this multiplication factor to estimate the amount of inflation. The default is to assume that half of all the inflated values are due to inflation, and the other half from the Poisson distribution. A value close to 1 is recommended for severe amounts of inflation.

imethod, ipstr0, ilambda

See CommonVGAMffArguments for information.

probs.y, ishrinkage

See CommonVGAMffArguments for information.

zero

See CommonVGAMffArguments for information. Setting zero = "pstr" will model the multinomial probabilities as simple as possible (intercept-only), hence should be more numerically stable than the default, and this is recommended for many analyses especially when there are many explanatory variables.

Value

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

The fitted.values slot of the fitted object, which should be extracted by the generic function fitted, returns the mean (default). The choice type.fitted = "pstr.i" returns the sum of all the inflated probabilities.

Details

The generally-inflated Poisson distribution is a mixture of an ordinary Poisson distribution and the probability of certain values (inflate argument) being inflated by a multinomial distribution. The latter is modelled by a multinomial logit model. Thus each inflated value has two sources: either from the Poisson distribution or the multinomial distribution. The 0-inflated Poisson distribution is a special case and is the default.

This family function can be easily misused. The data should exhibit strong evidence of inflation in certain values before the inflate argument is assigned these values. Deflation or very little inflation will result in numerical problems. The inflate argument should not be assigned a vector having too many values. Probably genapoisson is recommended in general instead as it handles deflation and inflation.

This function implements Fisher scoring and currently does not handle multiple responses.

See Also

Genipois, genapoisson, gentpoisson, zipoisson, zipoissonff, multinomial, CommonVGAMffArguments, simulate.vlm.

Examples

Run this code
# NOT RUN {
ivec <- c(0, 3)  # Inflate these values
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, x3 = runif(nn))
gdata <- transform(gdata, lambda1   = exp(1 + 2 * x2 + 0.5 * x3),
                          lambda2   = exp(1 - 1 * x2 + 0.5 * x3),
                          lambda3   = exp(1))
gdata <- transform(gdata,
  y1 = rgenipois(nn, lambda1, pstr.i = c(0.2, 0.3), byrow = TRUE,
                 inflate = ivec),
  y2 = rgenipois(nn, lambda2, pstr.i = c(0.2, 0.3), byrow = TRUE,
                 inflate = ivec),
  y3 = rgenipois(nn, lambda3, pstr.i = c(0.2, 0.3), byrow = TRUE,
                 inflate = ivec))
genipoisson(inflate = ivec)
with(gdata, table(y1))
with(gdata, table(y2))
with(gdata, table(y3))

fit1 <- vglm(y1 ~ x2 + x3, genipoisson(inflate = ivec),
             crit = "coef", trace = TRUE, data = gdata)
head(fitted(fit1))
head(predict(fit1))
coef(fit1, matrix = TRUE)
# summary(fit1)  # Currently does not work!!

# Another example ------------------------------
fit3 <- vglm(y3 ~ 1, genipoisson(inflate = ivec), gdata, trace = TRUE)
coef(fit3, matrix = TRUE)
# }

Run the code above in your browser using DataLab