Model Predictions for Multivariate Linear Models
predict.manylm is a function for predictions from the
result of the model fitting function
1 2 3
object of class inheriting from
an optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.
a switch indicating if standard errors are required.
type of prediction (response or model term), Possible values: "response", "terms".
if type="terms", which terms (default is all terms).
function determining what should be done with missing values in
newdata. The default is to predict
further arguments passed to or from other methods.
predict.manylm produces predicted values, obtained by evaluating
the regression function in the frame
newdata (which defaults to
model.frame(object). If the logical
TRUE, standard errors of the predictions are calculated. If
the numeric argument
scale is set (with optional
is used as the residual standard deviation in the computation of the
standard errors, otherwise this is extracted from the model fit.
intervals specifies computation of confidence or
prediction (tolerance) intervals at the specified
referred to as narrow vs. wide intervals.
If the fit is rank-deficient, some of the columns of the design matrix
will have been dropped. Prediction from such a fit only makes sense
newdata is contained in the same subspace as the original
data. That cannot be checked accurately, so a warning is issued.
newdata is omitted the predictions are based on the data
used for the fit. In that case how cases with missing values in the
original fit is determined by the
na.action argument of that
na.action = na.omit omitted cases will not appear in
the residuals, whereas if
na.action = na.exclude they will
appear (in predictions, standard errors or interval limits),
with residual value
NA. See also
The prediction intervals are for a single observation at each case in
newdata (or by default, the data used for the fit) with error
pred.var. This can be a multiple of
value of sigma^2: the default is to assume that future
observations have the same error variance as those
used for fitting. If
weights is supplied, the inverse of this
is used as a scale factor. For a weighted fit, if the prediction
is for the original data frame,
weights defaults to the weights
used for the model fit, with a warning since it might not be the
intended result. If the fit was weighted and newdata is given, the
default is to assume constant prediction variance, with a warning.
predict.manylm produces a matrix of predictions or if
is set an array of predictions and bounds, where the first dimension has the names:
TRUE, a list with the following components is returned:
vector or matrix as above
a matrix with the standard errors of the predicted means
vector or matrix as a vector of residual standard deviations
numeric, the degrees of freedom for residual
Variables are first looked for in
newdata and then searched for
in the usual way (which will include the environment of the formula
used in the fit). A warning will be given if the
variables found are not of the same length as those in
if it was supplied.
Offsets specified by
offset in the fit by
will not be included in predictions, whereas those specified by an
offset term in the formula will be.
Notice that prediction variances and prediction intervals always refer to future observations, possibly corresponding to the same predictors as used for the fit. The variance of the residuals will be smaller.
Strictly speaking, the formula used for prediction limits assumes that
the degrees of freedom for the fit are the same as those for the
residual variance. This may not be the case if
not obtained from the fit.
Ulrike Naumann, Yi Wang and David Warton <David.Warton@unsw.edu.au>.
1 2 3 4 5 6 7 8 9
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.