VGAM (version 1.0-4)

predictvglm: Predict Method for a VGLM fit


Predicted values based on a vector generalized linear model (VGLM) object.


predictvglm(object, newdata = NULL,
            type = c("link", "response", "terms"),
   = FALSE, deriv = 0, dispersion = NULL,
            untransform = FALSE,
            type.fitted = NULL, percentiles = NULL, ...)



Object of class inheriting from "vlm", e.g., vglm.


An optional data frame in which to look for variables with which to predict. If omitted, the fitted linear predictors are used.


The value of this argument can be abbreviated. The type of prediction required. The default is the first one, meaning on the scale of the linear predictors. This should be a \(n \times M\) matrix.

The alternative "response" is on the scale of the response variable, and depending on the family function, this may or may not be the mean. Often this is the fitted value, e.g., fitted(vglmObject) (see fittedvlm). Note that the response is output from the @linkinv slot, where the eta argument is the \(n \times M\) matrix of linear predictors.

The "terms" option returns a matrix giving the fitted values of each term in the model formula on the linear predictor scale. The terms have been centered.

logical: return standard errors?


Non-negative integer. Currently this must be zero. Later, this may be implemented for general values.


Dispersion parameter. This may be inputted at this stage, but the default is to use the dispersion parameter of the fitted model.


Some VGAM family functions have an argument by the same name. If so, then one can obtain fitted values by setting type = "response" and choosing a value of type.fitted from what's available. If type.fitted = "quantiles" is available then the percentiles argument can be used to specify what quantile values are requested.


Used only if type.fitted = "quantiles" is available and is selected.


Logical. Reverses any parameter link function. This argument only works if type = "link", = FALSE, deriv = 0. Setting untransform = TRUE does not work for all VGAM family functions; only ones where there is a one-to-one correspondence between a simple link function and a simple parameter might work.

Arguments passed into predictvlm.


If = FALSE, a vector or matrix of predictions. If = TRUE, a list with components



Estimated standard errors


Degrees of freedom


The square root of the dispersion parameter


This function may change in the future.


Obtains predictions and optionally estimates standard errors of those predictions from a fitted vglm object.

This code implements smart prediction (see smartpred).


Yee, T. W. and Hastie, T. J. (2003) Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15--41.

See Also

predict, vglm, predictvlm, smartpred.


Run this code
# Illustrates smart prediction
pneumo <- transform(pneumo, let = log(exposure.time))
fit <- vglm(cbind(normal, mild, severe) ~ poly(c(scale(let)), 2),
            propodds, data = pneumo, trace = TRUE, x.arg = FALSE)

(q0 <- head(predict(fit)))
(q1 <- predict(fit, newdata = head(pneumo)))
(q2 <- predict(fit, newdata = head(pneumo)))
all.equal(q0, q1)  # Should be TRUE
all.equal(q1, q2)  # Should be TRUE

head(predict(fit, untransform = TRUE))

p0 <- head(predict(fit, type = "response"))
p1 <- head(predict(fit, type = "response", newdata = pneumo))
p2 <- head(predict(fit, type = "response", newdata = pneumo))
p3 <- head(fitted(fit))
all.equal(p0, p1)  # Should be TRUE
all.equal(p1, p2)  # Should be TRUE
all.equal(p2, p3)  # Should be TRUE

predict(fit, type = "terms", se = TRUE)
# }

Run the code above in your browser using DataCamp Workspace