Learn R Programming

VGAM (version 1.1-1)

gentpoisson: Generally-Truncated Poisson Distribution Family Function

Description

Fits a generally-truncated Poisson distribution to produce MLEs.

Usage

gentpoisson(truncate = 0, zero = NULL, max.support = Inf, link = "loglink",
            type.fitted = c("mean", "lambda", "prob.t"),
            ilambda = NULL, imethod = 1)

Arguments

truncate

Vector of truncated 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-truncated) positive-Poisson.

link, zero, ilambda, imethod

See CommonVGAMffArguments for information.

max.support

See Gentpois for information.

type.fitted

See CommonVGAMffArguments for information. The choice "prob.t" means the probability of having a truncated value, given the estimate of lambda from an ordinary Poisson distribution. The mean can be be obtained by the extractor function fitted applied to the object (the default).

Value

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

Warning

Under- or over-flow may occur if the data is ill-conditioned. The response is checked to see that no values equal any values of the truncate vector. It is easy to misuse this function; the truncate vector should ideally not be very long and have values that can be justified by the application on hand. Hopefully soon, the ability to handle RHS-truncation will be allowed, i.e., something equivalent to truncate = (U+1):Inf for some upper support point U.

Details

The generally-truncated Poisson distribution is the ordinary Poisson distribution with the probability of certain values (truncate argument) being zero. Thus the other probabilities are scaled up. The (0-truncated) positive-Poisson distribution is a special case and is the default.

See Also

Gentpois, genapoisson, genipoisson, Pospois, pospoisson, poissonff, otpospoisson, zapoisson, zipoisson, simulate.vlm.

Examples

Run this code
# NOT RUN {
nnn <- 1000; tvec <- c(2, 3, 4)  # Truncate these values
rdata <- data.frame(x2 = runif(nnn), x3 = runif(nnn))
rdata <- transform(rdata, lambda1 = exp(1 + 2 * x2 + 0.5 * x3),
                          lambda2 = exp(1 - 1 * x2 + 0.5 * x3))
rdata <- transform(rdata, y1 = rgentpois(nnn, lambda1, trunc = tvec),
                          y2 = rgentpois(nnn, lambda2, trunc = tvec))
with(rdata, table(y1))
with(rdata, table(y2))
fit1 <- vglm(cbind(y1, y2) ~ x2 + x3, crit = "coef",
              gentpoisson(truncate = tvec), trace = TRUE, data = rdata)
coef(fit1, matrix = TRUE)
summary(fit1)
# }

Run the code above in your browser using DataLab