predict.vglm {VGAM} | R Documentation |
Predicted values based on a vector generalized linear model (VGLM) object.
predict.vglm(object, newdata = NULL, type = c("link", "response", "terms"), se.fit = FALSE, deriv = 0, dispersion = NULL, untransform=FALSE, extra = object@extra, ...)
object |
Object of class inheriting from "vlm" .
|
newdata |
An optional data frame in which to look for variables with which
to predict. If omitted, the fitted linear predictors are used.
|
type |
the type of prediction required. The default is the first one,
meaning on the scale of the linear predictors. 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.
The "terms" option returns a matrix giving the fitted values
of each term in the model formula on the linear predictor scale.
The value of this argument can be abbreviated. |
se.fit |
logical: return standard errors?
|
deriv |
Non-negative integer. Currently this must be zero.
Later, this may be implemented for general values.
|
dispersion |
Dispersion parameter.
This may be inputted at this stage, but the default is to use
the dispersion parameter of the fitted model.
|
extra |
A list containing extra information.
This argument should be ignored.
|
untransform |
Logical. Reverses any parameter link function.
This argument only works if type="link", se.fit=FALSE, deriv=0 .
|
... |
Arguments passed into predict.vlm .
|
Obtains predictions and optionally estimates standard errors of those predictions from a fitted vector generalized linear model (VGLM) object.
This code implements smart prediction
(see smartpred
).
If se.fit = FALSE
, a vector or matrix of predictions.
If se.fit = TRUE
, a list with components
fitted.values |
Predictions |
se.fit |
Estimated standard errors |
df |
Degrees of freedom |
sigma |
The square root of the dispersion parameter |
This function may change in the future.
Setting se.fit=TRUE
and type="response"
will generate an error.
Thomas W. Yee
Yee, T. W. and Hastie, T. J. (2003) Reduced-rank vector generalized linear models. Statistical Modelling, 3, 15–41.
predict
,
vglm
,
predict.vlm
,
smartpred
.
# Illustrates smart prediction data(pneumo) pneumo = transform(pneumo, let=log(exposure.time)) fit = vglm(cbind(normal,mild, severe) ~ poly(c(scale(let)), 2), fam=cumulative(parallel=TRUE), data=pneumo, trace=TRUE, x=FALSE) class(fit) (q0 = predict(fit)[1:3,]) (q1 = predict(fit, newdata=pneumo)[1:3,]) (q2 = predict(fit, newdata=pneumo[1:3,])) all.equal(q0, q1) # Should be TRUE all.equal(q1, q2) # Should be TRUE predict(fit)[1:3,] predict(fit, untransform=TRUE)[1:3,] p0 = predict(fit, type="res")[1:3,] p1 = predict(fit, type="res", newdata=pneumo)[1:3,] p2 = predict(fit, type="res", newdata=pneumo[1:3,]) p3 = fitted(fit)[1:3,] all.equal(p0, p1) # Should be TRUE all.equal(p1, p2) # Should be TRUE all.equal(p2, p3) # Should be TRUE predict(fit, type="t", se=TRUE)