Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

oalog

One-Altered Logarithmic Distribution


Description

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

Usage

oalog(lpobs1 = "logitlink", lshape = "logitlink",
      type.fitted = c("mean", "shape", "pobs1", "onempobs1"),
      ipobs1 = NULL, gshape = ppoints(8), zero = NULL)

Arguments

lpobs1

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

lshape

See logff for details.

gshape, type.fitted

See CommonVGAMffArguments and fittedvlm for information.

ipobs1, zero

See CommonVGAMffArguments for information.

Details

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

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

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 logarithmic distribution. If type.fitted = "pobs1" then pobs1 is returned.

Note

This family function effectively combines binomialff and otlog into one family function.

Author(s)

T. W. Yee

See Also

Examples

## Not run: odata <- data.frame(x2 = runif(nn <- 1000))
odata <- transform(odata, pobs1 = logitlink(-1 + 2*x2, inverse = TRUE),
                          shape  = logitlink(-2 + 3*x2, inverse = TRUE))
odata <- transform(odata, y1 = roalog(nn, shape = shape, pobs1 = pobs1),
                          y2 = roalog(nn, shape = shape, pobs1 = pobs1))
with(odata, table(y1))

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

## End(Not run)

VGAMdata

Data Supporting the 'VGAM' Package

v1.1-5
GPL-2
Authors
Thomas Yee [aut, cre, cph], James Gray [dtc]
Initial release
2021-01-13

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.