Difference between mean and fitted in forecast function

非 Y 不嫁゛ 提交于 2019-12-13 02:34:52

问题


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?

For example,

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.


回答1:


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


来源:https://stackoverflow.com/questions/35448610/difference-between-mean-and-fitted-in-forecast-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!