均值与拟合函数之间的差异 [英] Difference between mean and fitted in forecast function
问题描述
我对预测是陌生的,我正在尝试使用r中的预测包.
I'm new to forecasting and I'm trying to use the forecast package in r.
有人可以解释预测函数中均值和拟合值之间的区别吗?
Can someone please explain the difference between mean and fitted in the forecast function?
例如,
fcast<-forecast(ts,h=30)
fcast$mean
fcast$fitted
文档说平均是指点预测作为时间序列" 和拟合的是拟合值(一步预测)".
The documentation says "mean is Point forecasts as a time series" and "fitted is Fitted values (one-step forecasts)".
一个说明差异的示例将非常有用.任何帮助表示赞赏.
An example to illustrate the difference would be great. Any help much appreciated.
推荐答案
fcast$fitted
是拟合的结果(适合观察的模型),fcast$mean
是预测的结果(模型对未来).您可以比较length(ts)
和length(fcast$fitted)
.然后length(fcast$mean)
和您选择的h
.
fcast$fitted
is the result of the fit (the model fitted to observation) and fcast$mean
is the result of the forecast (the application of the model to the future). You can compare length(ts)
and length(fcast$fitted)
. And length(fcast$mean)
and the h
you choose.
library(forecast)
fit <- Arima(WWWusage,order=c(3,1,0))
h <- 20
fcast <- forecast(fit, h = h)
length(WWWusage)
# [1] 100
length(fcast$fitted)
# [1] 100
h
# [1] 20
length(fcast$mean)
# [1] 20
这篇关于均值与拟合函数之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!