如何让exog =与ARMA / ARIMA合作?

时间:2017-06-15 20:27:57

标签: python time-series

  

indexed_prime

Date Rev Base ARMadj GSPrice
日期 2014-11-29 2014-11-29 124052.979500 516891.200 -8100.0 60.0 2014-12-06 2014-12-06 74197.122760 1033782.400 -9260.0 60.0 2014-12-13 2014-12-13 65113.157960 1550673.600 -7300.0 60.0 2014-12-20 2014-12-20 62540.688660 2067564.800 -8100.0 60.0 2014-12-27 2014-12-27 27166.139050 2089491.810 -9260.0 60.0 2015-01-03 2015-01-03 39491.384120 2111418.820 -7300.0 60.0 2015-01-10 2015-01-10 24158.035070 2133345.830 -4240.0 60.0 2015-01-17 2015-01-17 26423.724870 2155272.840 -1460.0 60.0 2015-01-24 2015-01-24 23256.475760 2161877.480 372.0 60.0 2015-01-31 2015-01-31 17122.817350 2168482.120 1190.0 60.0 2015-02-07 2015-02-07 23105.257360 2175086.760 1250.0 60.0 2015-02-14 2015-02-14 28942.415480 2181691.400 876.0 60.0 2015-02-21 2015-02-21 24446.400630 2184149.968 388.0 60.0 2015-02-28 2015-02-28 15850.090840 2186608.536 -24.3 60.0 2015-03-07 2015-03-07 15591.600440 2189067.104 -280.0 60.0 2015-03-14 2015-03-14 24523.027370 2191525.672 -381.0 60.0 2015-03-21 2015-03-21 32004.347500 2193984.240 -371.0 60.0 2015-03-28 2015-03-28 27826.800740 2197643.770 -305.0 60.0 2015-04-04 2015-04-04 20206.361870 2201303.300 -228.0 60.0 2015-04-11 2015-04-11 19141.036990 2204962.830 -168.0 60.0 2015-04-18 2015-04-18 22040.487130 2208622.360 -133.0 60.0 2015-04-25 2015-04-25 24693.562020 2211230.140 -121.0 60.0 2015-05-02 2015-05-02 25908.055260 2213837.920 -125.0 60.0

  

print(indexed.prime.dtypes)   日期datetime64 [ns]   Seasadjrev float64   Base float64   ARMadj float64   GSPrice float64

indexed_prime3 = indexed_prime.drop('Rev',axis = 1)     导入numpy为np     来自scipy import stats     将pandas导入为pd     将matplotlib.pyplot导入为plt     将statsmodels.api导入为sm     来自pandas.tools.plotting import autocorrelation_plot     arma_mod22 = sm.tsa.ARMA(indexed_df ['Rev'],order =(2,2)exog = indexed_prime3)nets:

文件“”,第1行,in   文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ tsa \ arima_model.py”,第445行, init     super(ARMA,self)。 init (endog,exog,dates,freq,missing = missing)   文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ tsa \ base \ tsa_model.py”,第41行,在 init 中     super(TimeSeriesModel,self)。 init (endog,exog,missing = missing)   文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ base \ model.py”,第186行,在 init 中     super(LikelihoodModel,self)。 init (endog,exog,** kwargs)   文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ base \ model.py”,第60行, init     ** kwargs)   文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ base \ model.py”,第84行,在_handle_data中     data = handle_data(endog,exog,missing,hasconst,** kwargs)   handle_data中的文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ base \ data.py”,第566行     ** kwargs)   文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ base \ data.py”,第72行, init     self.endog,self.exog = self._convert_endog_exog(endog,exog)   _convert_endog_exog中的文件“C:\ ProgramData \ Anaconda3 \ lib \ site-packages \ statsmodels \ base \ data.py”,第428行     引发ValueError(“Pandas数据转换为numpy dtype of object”。 ValueError:Pandas数据转换为numpy dtype对象。使用np.asarray(数据)检查输入数据。

  
    

>

  

我无法弄清楚如何将外生变量引入模型 - 有人可以帮忙吗?

0 个答案:

没有答案