4
$\begingroup$

I am using the arch package in python to fit a GARCH(1,1) to fit daily S&P 500 returns from 1990 to 2017 (about 6800 data points). The code I am using is as follows:

sp500 = pd.read_csv('sp.csv', index_col=0, parse_dates=True, squeeze=True)
sp500 = (np.log(sp500) - np.log(sp500.shift(1))).dropna()[::-1]

from arch import arch_model
garch11 = arch_model(sp500, p=1, q=1)
res = garch11.fit(update_freq=10)
print res.summary()

Even for just 50 data points, the solver fails to converge, citing

The optimizer returned code 8. The message is:
Positive directional derivative for linesearch
See scipy.optimize.fmin_slsqp for code meaning. ConvergenceWarning)

It seems ridiculous that it can't fit 50 data points. Are there any tweaks to get this working?

$\endgroup$
  • $\begingroup$ You may be looking for an ARMA(1,1) model with GARCH(1,1) errors, very common in this type of modeling. $\endgroup$ – user25064 Feb 16 '17 at 15:06
  • $\begingroup$ @user25064 that doesn't answer my question. $\endgroup$ – user369210 Feb 23 '17 at 18:29
  • $\begingroup$ @user321210 did you somehow solve your problem? I have the same issue when running the arch_model function. $\endgroup$ – joomanda Jun 13 '17 at 11:46
  • 3
    $\begingroup$ @joomanda yes I did! Scale all your data by a factor of 100. Check the first example here: pypi.python.org/pypi/arch/3.0. It seems that the optimizer fails when the values are too close to 0 $\endgroup$ – user369210 Jun 18 '17 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.