iankhr / armagarch

ARMA-GARCH
Other
89 stars 27 forks source link

Can't use this to predict. #4

Open NinelieAimer opened 3 years ago

NinelieAimer commented 3 years ago

I'm sorry to bother you, I can't use your package to predict the results. I can use this package to predict arma(4,0)-grach(1,1), but when I bulid arma(4,0)-grach(1,2) there is something wrong, please help me, I'm really in a hurry.

`--------------------------------------------------------------------------- ValueError Traceback (most recent call last)

in ----> 1 pred = model.predict(nsteps = 1) D:\Anaconda\lib\site-packages\armagarch\empModel.py in predict(self, nsteps, params, data, other) 253 mPred = self._mean.predict(nsteps, params = pars[0], data = data, other = other) 254 # get prediction for volatility --> 255 vPred = self._vol.predict(nsteps, params = pars[1], data = mdlres['et'], other = other) 256 return [mPred, vPred] 257 D:\Anaconda\lib\site-packages\armagarch\garch.py in predict(self, nsteps, params, data, other) 162 for t in range(nsteps): 163 if self._order['q']>0: --> 164 prediction[t] = prediction[t] + laght[t:t+self._order['q']][::-1]@beta 165 166 if self._order['p']>0: ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 2 is different from 1)`
silkyrose commented 2 years ago

I use the example code and got the following error: Traceback (most recent call last): File "D:/!paper/第六篇/newtxt/exp/getdata/predict.py", line 25, in model.fit() File "C:\Users\wj\Anaconda3\lib\site-packages\armagarch-1.0.2-py3.6.egg\armagarch\empModel.py", line 161, in fit File "C:\Users\wj\Anaconda3\lib\site-packages\scipy\optimize\slsqp.py", line 208, in fmin_slsqp constraints=cons, *opts) File "C:\Users\wj\Anaconda3\lib\site-packages\scipy\optimize\slsqp.py", line 379, in _minimize_slsqp fx = func(x) File "C:\Users\wj\Anaconda3\lib\site-packages\scipy\optimize\optimize.py", line 293, in function_wrapper return function((wrapper_args + args))

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().