精度函数
Accuracy Function
我正在进行 TS 分析。这两个精度有什么区别:
fit<-auto.arima(tsdata)
fcast<-forecast(fit,6)
accuracy(fcast) #### First Accuracy
fit<-auto.arima(tsdata)
fcast<-forecast(fit,6)
accuracy(fcast,actual values) #### Second Accuracy
当我没有像第一种情况那样在精度函数中指定实际值时,精度函数如何工作。
其次,正确的计算准确率的方法是什么?
在这个答案中,我假设您正在使用 forecast
包中的函数。
答案就在accuracy
的描述中:
Returns range of summary measures of the forecast accuracy. If x is provided, the function measures out-of-sample (test set) forecast accuracy based on x-f. If x is not provided, the function only produces in-sample (training set) accuracy measures of the forecasts based on f["x"]-fitted(f). All measures are defined and discussed in Hyndman and Koehler (2006).
在你的例子中 x
是函数的第二个参数。因此,简而言之,accuracy(fcst)
提供了基于训练集的预测误差估计。
例如:假设您有 12 个月,并预测未来 6 个月。然后,如果您使用 accuracy(fcst)
,您会在 12 个月内(仅)得到模型的错误。
现在,我们假设 x
= 您预测的 6 个月的实际需求。而且您没有使用这些数据来构建 Arima 模型。在这种情况下,accuracy(fcst, x)
为您提供测试集误差,这是衡量您将来使用此模型获得的结果的更好衡量标准(与训练集误差相比)。
最佳做法是使用测试集误差,因为此度量不太容易产生偏差(您很可能会在训练集上然后在 "hideout" 测试集上获得 "better" 预测结果,但这些结果将是一种 "overfitting")。如果你有测试集,你应该使用测试集作为第二个参数。
我正在进行 TS 分析。这两个精度有什么区别:
fit<-auto.arima(tsdata)
fcast<-forecast(fit,6)
accuracy(fcast) #### First Accuracy
fit<-auto.arima(tsdata)
fcast<-forecast(fit,6)
accuracy(fcast,actual values) #### Second Accuracy
当我没有像第一种情况那样在精度函数中指定实际值时,精度函数如何工作。
其次,正确的计算准确率的方法是什么?
在这个答案中,我假设您正在使用 forecast
包中的函数。
答案就在accuracy
的描述中:
Returns range of summary measures of the forecast accuracy. If x is provided, the function measures out-of-sample (test set) forecast accuracy based on x-f. If x is not provided, the function only produces in-sample (training set) accuracy measures of the forecasts based on f["x"]-fitted(f). All measures are defined and discussed in Hyndman and Koehler (2006).
在你的例子中 x
是函数的第二个参数。因此,简而言之,accuracy(fcst)
提供了基于训练集的预测误差估计。
例如:假设您有 12 个月,并预测未来 6 个月。然后,如果您使用 accuracy(fcst)
,您会在 12 个月内(仅)得到模型的错误。
现在,我们假设 x
= 您预测的 6 个月的实际需求。而且您没有使用这些数据来构建 Arima 模型。在这种情况下,accuracy(fcst, x)
为您提供测试集误差,这是衡量您将来使用此模型获得的结果的更好衡量标准(与训练集误差相比)。
最佳做法是使用测试集误差,因为此度量不太容易产生偏差(您很可能会在训练集上然后在 "hideout" 测试集上获得 "better" 预测结果,但这些结果将是一种 "overfitting")。如果你有测试集,你应该使用测试集作为第二个参数。