Learn R Programming

VGAM (version 1.1-2)

gatpoisson.mix: Generally-Altered and -Truncated Poisson Regression Family Function (GAT--Pois--Pois Mixture Variant)

Description

Fits a generally-altered and -truncated Poisson regression (mixtures of Poissons on differing support). The truncation may include values in the upper tail.

Usage

gatpoisson.mix(alter = NULL, truncate = NULL, max.support = Inf,
    zero = "pobs.a", parallel = FALSE,
    lpobs.a = "logitlink", llambda.p = "loglink", llambda.a = "loglink",
    type.fitted = c("mean", "pobs.a", "Pobs.a", "prob.a", "prob.t", "lhs.prob"),
    imethod = 1, ilambda.p = NULL, ilambda.a = NULL, ishrinkage = 0.95,
    probs.y = 0.35)

Arguments

alter, truncate

Vector of altered and truncated values, i.e., nonnegative integers. Note: alter must be assigned a vector of length 2 or more for this function to work. Both arguments must have unique values only, and no values in common. In contrast, truncate may be a NULL, which stands for an empty set. The default settings should make this function equivalent to poissonff.

lpobs.a, llambda.p, llambda.a

Link functions; the .p and .a refer to the parent and altered distributions respectively. See Links for more choices and information.

parallel

Constrain the rate parameters to be equal? See CommonVGAMffArguments for information. After plotting the responses, if the distribution of the spikes has roughly the same shape as the ordinary values then setting this argument to TRUE would be a good idea. And probably if alter is of length 2 or thereabouts, then TRUE should definitely be entertained.

type.fitted, max.support

See CommonVGAMffArguments and gatpoisson.mlm for information.

The choice "lhs.prob" is the 1 minus the probability of value greater than "max.support", using the parent distribution.

imethod, ilambda.p, ilambda.a

See CommonVGAMffArguments for information.

probs.y, ishrinkage

See CommonVGAMffArguments for information.

zero

See CommonVGAMffArguments for information. Having zero = "pobs.a" will model the mixing probability as simple as possible (intercept-only), hence should be more numerically stable than NULL; and zero = "pobs.a" is recommended for many analyses especially when there are many explanatory variables.

Note that the default value of this argument is not NULL, hence this family function should ideally be called gatpoisson.mixff to keep it consistent with other family function names such as zipoissonff, zapoissonff etc.

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, are similar to gatpoisson.mlm.

Warning

The same caution needed for gatpoisson.mlm applies here, however this function is a bit more parametric (structured) in comparison, especially when parallel = TRUE.

Details

The distribution being fitted can be abbreviated GAT-Pois-Pois, which is where the inner distribution for ordinary values is the Poisson distribution, and the outer distribution for the altered values is another Poisson distribution with a different rate parameter by default. Thus the distribution being fitted is a mixture of two Poissons with differing support. The two rate parameters may be constrained to be equal using parallel. By default, a logistic regression models the probability that the response is altered.

This function currently does not handle multiple responses. Further details are at Gaitpois.mix. An alternative variant of this distribution is based on the MLM---details can be found in gatpoisson.mlm.

References

Yee, T. W. and Ma, C. C. (2019) Generally-altered, -inflated and -truncated count regression, with application to heaped and seeped data. In preparation.

See Also

Gaitpois.mix, gatpoisson.mlm, gatnbinomial.mix, rpospois, CommonVGAMffArguments, simulate.vlm.

Examples

Run this code
# NOT RUN {
avec <- c(3, 15)  # Alter these values
tvec <- c(5, 7)   # Truncate these values
pobs.a <- logitlink(-1, inverse = TRUE)  # About 0.27
max.support <- 20
gdata <- data.frame(x2 = runif(nn <- 1000))
gdata <- transform(gdata, lambda.p = exp(2 + 0.5 * x2))
gdata <- transform(gdata,
  y1 = rgaitpois.mix(nn, lambda.p = lambda.p, pobs.a = pobs.a,
         truncate = tvec, max.support = max.support, alter = avec))
gatpoisson.mix(alter = avec)
with(gdata, table(y1))
fit1 <- vglm(y1 ~ x2, crit = "coef", trace = TRUE, data = gdata,
             gatpoisson.mix(alter = avec, truncate = tvec,
                            zero = "pobs.a", parallel = TRUE,
                            max.support = max.support))             
head(fitted(fit1, type.fitted = "Pobs.a"))
head(predict(fit1))
coef(fit1, matrix = TRUE)
summary(fit1)
# }

Run the code above in your browser using DataLab