Learn R Programming

VGAM (version 1.0-6)

oapospoisson: One-Altered Positive-Poisson Distribution

Description

Fits a one-altered positive-Poisson distribution based on a conditional model involving a Bernoulli distribution and a 1-truncated positive-Poisson distribution.

Usage

oapospoisson(lpobs1 = "logit", llambda = "loge",
             type.fitted = c("mean", "lambda", "pobs1", "onempobs1"),
             ipobs1 = NULL, zero = NULL)

Arguments

lpobs1

Link function for the parameter \(p_1\) or \(\phi\), called pobs1 or phi here. See Links for more choices.

llambda

See pospoisson for details.

type.fitted

See CommonVGAMffArguments and fittedvlm for information.

ipobs1, zero

See CommonVGAMffArguments for information.

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 \(\mu\) (default) which is given by $$\mu = \phi + (1-\phi) A$$ where \(A\) is the mean of the one-truncated positive-Poisson distribution. If type.fitted = "pobs1" then \(p_1\) is returned.

Details

The response \(Y\) is one with probability \(p_1\), or \(Y\) has a 1-truncated positive-Poisson distribution with probability \(1-p_1\). Thus \(0 < p_1 < 1\), which is modelled as a function of the covariates. The one-altered positive-Poisson distribution differs from the one-inflated positive-Poisson distribution in that the former has ones coming from one source, whereas the latter has ones coming from the positive-Poisson distribution too. The one-inflated positive-Poisson distribution is implemented in the VGAM package. Some people call the one-altered positive-Poisson a hurdle model.

The input can be a matrix (multiple responses). By default, the two linear/additive predictors of oapospoisson are \((logit(\phi), log(\lambda))^T\).

See Also

Oapospois, pospoisson, oipospoisson, CommonVGAMffArguments, simulate.vlm.

Examples

Run this code
# NOT RUN {
odata <- data.frame(x2 = runif(nn <- 1000))
odata <- transform(odata, pobs1  = logit(-1 + 2*x2, inverse = TRUE),
                          lambda =  loge( 1 + 1*x2, inverse = TRUE))
odata <- transform(odata, y1 = roapospois(nn, lambda = lambda, pobs1 = pobs1),
                          y2 = roapospois(nn, lambda = lambda, pobs1 = pobs1))
with(odata, table(y1))

ofit <- vglm(cbind(y1, y2) ~ x2, oapospoisson, data = odata, trace = TRUE)
coef(ofit, matrix = TRUE)
head(fitted(ofit))
head(predict(ofit))
summary(ofit)
# }

Run the code above in your browser using DataLab