gpt4 book ai didi

R预测警告

转载 作者:行者123 更新时间:2023-12-04 18:21:41 25 4
gpt4 key购买 nike

正在做: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)

关于R预测警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47551993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com