Learn R Programming

VGAM (version 1.0-5)

multilogit: Multi-logit Link Function

Description

Computes the multilogit transformation, including its inverse and the first two derivatives.

Usage

multilogit(theta, refLevel = "(Last)", M = NULL, whitespace = FALSE,
           bvalue = NULL, inverse = FALSE, deriv = 0, all.derivs = FALSE,
           short = TRUE, tag = FALSE)

Arguments

theta

Numeric or character. See below for further details.

refLevel, M, whitespace
bvalue

See Links.

all.derivs

Logical. This is currently experimental only.

inverse, deriv, short, tag

Details at Links.

Value

For multilogit with deriv = 0, the multilogit of theta, i.e., log(theta[, j]/theta[, M+1]) when inverse = FALSE, and if inverse = TRUE then exp(theta[, j])/(1+rowSums(exp(theta))).

For deriv = 1, then the function returns d eta / d theta as a function of theta if inverse = FALSE, else if inverse = TRUE then it returns the reciprocal.

Here, all logarithms are natural logarithms, i.e., to base e.

Details

The multilogit() link function is a generalization of the logit link to \(M\) levels/classes. It forms the basis of the multinomial logit model. It is sometimes called the multi-logit link or the multinomial logit link. When its inverse function is computed it returns values which are positive and add to unity.

References

McCullagh, P. and Nelder, J. A. (1989) Generalized Linear Models, 2nd ed. London: Chapman & Hall.

See Also

Links, multinomial, logit, normal.vcm, CommonVGAMffArguments.

Examples

Run this code
# NOT RUN {
pneumo <- transform(pneumo, let = log(exposure.time))
fit <- vglm(cbind(normal, mild, severe) ~ let,
            multinomial, trace = TRUE, data = pneumo)  # For illustration only!
fitted(fit)
predict(fit)

multilogit(fitted(fit))
multilogit(fitted(fit)) - predict(fit)  # Should be all 0s

multilogit(predict(fit), inverse = TRUE)  # rowSums() add to unity
multilogit(predict(fit), inverse = TRUE, refLevel = 1)  # For illustration only
multilogit(predict(fit), inverse = TRUE) - fitted(fit)  # Should be all 0s

multilogit(fitted(fit), deriv = 1)
multilogit(fitted(fit), deriv = 2)
# }

Run the code above in your browser using DataLab