Doing:predictions <- predict(lm.sqrtFlatprices, interval='prediction', level = 0.68) ^ 2
I get:predictions on current data refer to _future_ responses
Why is this warning exist, and how can i suppress it?
From ?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.
Essentially, R is making some assumptions in order to use to calculate the predicted value limits (as opposed to the confidence limits of the fitted value) and wants you to be aware of the assumptions it is making. The actual warning assumes that the user has read the documentation at ?predict.lm
.
If you are unconcerned with the assumptions and wish to suppress the warning, you may use
suppressWarnings(predict(lm.sqrtFlatprices, interval='prediction', level = 0.68) ^ 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With