我正在尝试使用statsmodels.api.tsa.SARIMAX函数来模拟一些30分钟的频率时间序列数据,但我收到的错误如下。
SARIMAX函数未包含在最新发布的statsmodels版本中,所以我已经从http://statsmodels.sourceforge.net/binaries/statsmodels-0.7.0-2670ed0.win-amd64-py3.4.exe下载并安装了使用conda创建的python 3.4环境的开发版本。
一切都在Jupyter笔记本中运行,我的数据看起来像这样:
print(binned_vals.head(15))
2016-01-07 09:00:00 21394
2016-01-07 09:30:00 236515
2016-01-07 10:00:00 161676
2016-01-07 10:30:00 223484
2016-01-07 11:00:00 167918
2016-01-07 11:30:00 198435
2016-01-07 12:00:00 99343
2016-01-07 12:30:00 150210
2016-01-07 13:00:00 254153
2016-01-07 13:30:00 258123
2016-01-07 14:00:00 97485
2016-01-07 14:30:00 0
2016-01-07 15:00:00 0
2016-01-07 15:30:00 0
2016-01-07 16:00:00 0
Freq: 30T, Name: value, dtype: int64
错误是:
fit1 = sm.tsa.SARIMAX(binned_vals, order=(0,1,0))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-24-f42d87d7881a> in <module>()
1 # fit1 = model(binned_vals, (0,1,0), (0,0,0,0))
----> 2 fit1 = sm.tsa.SARIMAX(binned_vals, order=(0,1,0))
C:\Users\Gus\Anaconda3\envs\py34\lib\site-packages\statsmodels\tsa\statespace\sarimax.py in __init__(self, endog, exog, order, seasonal_order, trend, measurement_error, time_varying_regression, mle_regression, simple_differencing, enforce_stationarity, enforce_invertibility, hamilton_representation, **kwargs)
517 self.ssm.design = self.initial_design
518 self.ssm.state_intercept = self.initial_state_intercept
--> 519 self.ssm.transition = self.initial_transition
520 self.ssm.selection = self.initial_selection
521
C:\Users\Gus\Anaconda3\envs\py34\lib\site-packages\statsmodels\tsa\statespace\sarimax.py in initial_transition(self)
776
777 # T_c
--> 778 transition[start:end, start:end] = companion_matrix(self._k_order)
779 if self.hamilton_representation:
780 transition[start:end, start:end] = np.transpose(
ValueError: could not broadcast input array from shape (0,0) into shape (1,1)
我已经搜索谷歌相关的错误,但没有太多信息(可能是因为这是一个开发函数!)。
任何帮助都非常感谢...