predict.bs,
,
predict.coxph.penal,
,
,
,
,
,
,
,
,
,
predict.lmRobMM,
,
,
,
,
predict.nls,
predict.ns,
,
,
,
,
predict.survReg.penal,
,
,
.
predict(object, ...) predict(object, newdata, ...) # most methods have second argument newdata predict(object, newx, ...) # some methods have second argument newx
newdata or
newx
indicating new data (explanatory variables) for which predictions
are desired. If omitted then predictions (fitted values) for
the original data are returned.
x and
y components of points on a prediction curve.
predict is to simply extract the fitted values
from a fit object, or in the case of generalized models,
to extract the linear or additive predictor.
Argument lists and detailed information are available by clicking the link on the specific method
you are currently working with. For example, if you have a linear model object
testdata.lm <- lm(y ~ x1 + x2, data=testdata)
and you wish to use
predict(), then click the link for
.
Calling
predict on objects of class
"lm",
"bdLm",
"glm", or
bdGlm can produce incorrect predictions when the
newdata argument is used if the formula in
object involves
data-dependent transformations, such as
poly(Age, 3) or
sqrt(Age - min(Age)).
The
predict.gam method overcomes this for the
gam,
glm, and
lm classes.
In other cases, this can be overcome by explicitly supplying the
derived
matrix for predictions, rather than a data frame.
# extract the fitted linear predictor from a glm object
glmob <- glm(Kyphosis ~ poly(Age, 2) + (Number > 5)*Start,
family = binomial, data = kyphosis)
predict(glmob)
predict(gamob, newdata, type = "terms")