均值与拟合函数之间的差异 [英] Difference between mean and fitted in forecast function

查看:154
本文介绍了均值与拟合函数之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对预测是陌生的,我正在尝试使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆