在我开发了用于样本分析的小ARMAX预测模型之后,我想预测一些样本外的数据。
我用于预测计算的时间序列从2013-01-01开始,到2013-12-31结束!
以下是我正在处理的数据:hr = np.loadtxt("Data_2013_17.txt")
index = date_range(start='2013-1-1', end='2013-12-31', freq='D')
df = pd.DataFrame(hr, index=index)
holidays = ['2013-1-1', '2013-3-29', '2013-4-1', '2013-5-1', '2013-5-9', '2013-5-20', '2013-10-3', '2013-12-25', '2013-12-26']
# holidays for all Bundesländer
idx = df.asfreq('B').index - DatetimeIndex(holidays)
indexed_df = df.reindex(idx)
# indexed_df = df.asfreq('B') (includes holidays)
# 'D'=day
#'B'=business day
# W@MON=shows only mondays
# external variable
hr_ = np.loadtxt("Data_2_2013.txt")
index = date_range(start='2013-1-1', end='2013-12-31', freq='D')
df = pd.DataFrame(hr_, index=index)
idx2 = df.asfreq('B').index - DatetimeIndex(holidays)
external_df1 = df.reindex(idx2)
external_df = external_df1.fillna(external_df1.mean())
输出:0
2013-01-02 49.56
2013-01-03 48.09
2013-01-04 36.79
2013-01-07 60.84
2013-01-08 59.72
2013-01-09 61.88
2013-01-10 57.95
2013-01-11 56.29
2013-01-14 57.89
2013-01-15 64.49
2013-01-16 58.92
2013-01-17 62.30
2013-01-18 55.92
2013-01-21 55.67
2013-01-22 60.73
2013-01-23 60.12
2013-01-24 65.70
2013-01-25 55.15
2013-01-28 51.79
2013-01-29 39