fitted.vlm {VGAM}R Documentation

Fitted Values of a VLM object

Description

Extractor function for the fitted values of a model object that inherits from a vector linear model (VLM), e.g., a model of class "vglm".

Usage

fitted.vlm(object, matrix = TRUE, ...)

Arguments

object a model object that inherits from a VLM.
matrix Logical. Return the answer as a matrix? If FALSE then it will be a vector.
... Currently unused.

Details

The ``fitted values'' usually corresponds to the mean response, however, because the VGAM package fits so many models, this sometimes refers to quantities such as quantiles. The mean may even not exist, e.g., for a Cauchy distribution.

Value

The fitted values as returned by the inverse slot of the VGAM family function, evaluated at the final IRLS iteration.

Note

This function is one of several extractor functions for the VGAM package. Others include coef, deviance, weights and constraints etc. This function is equivalent to the methods function for the generic function fitted.values.

If fit is a VLM or VGLM then fitted(fit) and predict(fit, type="response") should be equivalent. The latter has the advantage in that it handles a newdata argument so that the fitted values can be computed for a different data set.

Author(s)

Thomas W. Yee

References

Chambers, J. M. and T. J. Hastie (eds) (1992) Statistical Models in S. Wadsworth & Brooks/Cole.

See Also

fitted, predict.vglm, vglmff-class.

Examples

# Categorical regression example 1
data(pneumo)
pneumo = transform(pneumo, let=log(exposure.time))
fit = vglm(cbind(normal, mild, severe) ~ let,
           cumulative(parallel=TRUE, reverse=TRUE), pneumo)
fit
fitted(fit)

# LMS quantile regression example 2
data(bminz)
fit = vgam(BMI ~ s(age, df=c(4,2)), 
           fam=lms.bcn(zero=1), data=bminz, trace=TRUE)
# The following are equal
predict(fit, type="r")[1:3,]
fitted(fit)[1:3,]
predict(fit, type="r", newdata=bminz[1:3,])

[Package VGAM version 0.7-7 Index]