R预测警告

R predict warning

正在做:
predictions <- predict(lm.sqrtFlatprices, interval='prediction', level = 0.68) ^ 2

我得到:
predictions on current data refer to _future_ responses

为什么会出现这个警告,我该如何抑制它?

来自?predict.lm

The prediction intervals are for a single observation at each case in newdata (or by default, the data used for the fit) with error variance(s) pred.var. This can be a multiple of res.var, the estimated value of σ^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.

本质上,R 正在做出一些假设,以便用于计算预测值限制(与拟合值的置信限制相反),并希望您了解它所做的假设。实际警告假定用户已阅读 ?predict.lm.

处的文档

如果您不关心这些假设并希望取消警告,您可以使用

suppressWarnings(predict(lm.sqrtFlatprices, interval='prediction', level = 0.68) ^ 2)