R中的预测值相同 [英] Forecasting Values are coming same in R
问题描述
我有一个样本数据
Sno period year_quarter country city sales_revenue
1 1/1/2009 2009-Q1 Argentina Buenos Aires 3008
2 1/4/2009 2009-Q2 Argentina Buenos Aires 3244
3 1/7/2009 2009-Q3 Argentina Buenos Aires 8000
4 1/10/2009 2009-Q4 Argentina Buenos Aires 8719
5 1/1/2010 2010-Q1 Argentina Buenos Aires 3008
6 1/4/2010 2010-Q2 Argentina Buenos Aires 3244
7 1/7/2010 2010-Q3 Argentina Buenos Aires 78
8 1/10/2010 2010-Q4 Argentina Buenos Aires 7379
9 1/1/2011 2011-Q1 Argentina Buenos Aires 3735
10 1/4/2011 2011-Q2 Argentina Buenos Aires 7339
11 1/7/2011 2011-Q3 Argentina Buenos Aires 17240
12 1/10/2011 2011-Q4 Argentina Buenos Aires 20465
13 1/1/2012 2012-Q1 Argentina Buenos Aires 13134
14 1/4/2012 2012-Q2 Argentina Buenos Aires 15039
借助ETS(A,N,N)预测了第三季度,即2012年第三季度,2012年第四季度和2013年第一季度,预测代码如下
I forecasted the three quarter i.e 2012 q3, 2012 q4 and 2013 q1 with the help of the ETS(A,N,N).Code for the prediction is as below
retail_data.xts<-xts(retail_data$sales_revenue, retail_data$period);
retail_data.ts <- as.ts(retail_data.xts);
retail_data.ets <- ets(retail_data.ts,model="ANN");
retail_data.fore <- forecast(retail_data.ets, h=4);
plot(retail_data.fore);
计算结果为
Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
15 14905.37 8925.968 20884.78 5760.6608 24050.09
16 14905.37 7202.071 22608.68 3124.1881 26686.56
17 14905.37 5798.868 24011.88 978.1739 28832.58
18 14905.37 4584.713 25226.04 -878.7150 30689.46
所有预测值都相同.
是因为数据集太小还是我的方法不好?
需要建议.
All the forecast values are the same.
Is it due to the small dataset or my approach is not good?
Need advice.
推荐答案
通过使用model = "ANN"
,您可以拟合具有加法误差(A)的简单指数平滑模型.有关可能的模型,请参见help(ets)
;对于自动模型选择,请保留模型参数.您的模型没有趋势,也没有季节性(NN).
By using model = "ANN"
you are fitting a simple exponential smoothing model with additive errors (A). See help(ets)
for possible models or leave the model argument out for automatic model selection. Your model includes no trend and no seasonality (NN).
有关可能模型的数学详细信息,请参见使用指数自动预测的状态空间框架平滑方法,如ets
的帮助页面上所述.如第441和442页所述,序列级别 l_t 是原始时间序列 Y_t 的线性函数.在没有趋势和季节性的模型(例如ANN)中,预测 F_ {t + h} 不依赖于 h , F_ {t + h} = l_t .这就是为什么上面的示例中的预测在所有范围内都是相同的,只是置信区间随着 h 的增加而扩大.
Mathematical details on the possible models are given in A state space framework for automatic forecasting using exponential smoothing methods as stated on the help page for ets
. As explained on pages 441 and 442, the series level l_t is a linear function of the original time series Y_t. In a model without trend and seasonality (e.g. ANN) the forecasts F_{t+h} are not dependent on h, F_{t+h} = l_t. This is why the forecasts in the above example are the same for all horizons, only the confidence intervals widen with increasing h.
我想在这里讨论哪种模型合适是合适的,但是我认为鉴于时间序列较短,使用指数平滑的方法是合理的.
I guess a discussion on which model is appropriate would be OT here, but I think your approach using exponential smoothing is reasonable given the short time series.
这篇关于R中的预测值相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!