Ejemplo n.º 1
0
                garch_model.params['alpha[1]'],\
                garch_model.params['beta[1]']
        
    forecaster = hlp.GarchForecaster(params)

    garch_predict = pd.Series(test_volatility,dtype=float)\
                        .apply(lambda x: forecaster.forecast(x))\
                        .shift(1)
        

    dFrame = pd.DataFrame(test_volatility, columns=['Actual'])
    dFrame['Predict'] = garch_predict
    dFrame.plot(title=cur)
        
        
    y = dFrame.loc[1:,'Actual']
    yhat = dFrame.loc[1:,'Predict']
    mfe = hlp.mean_forecast_err(y,yhat)
    mae = hlp.mean_absolute_err(y,yhat)
        
    print 'MFE={}\nMAE={}\n\n'.format(mfe,mae*100)

plt.show()
        



#http://www.quantatrisk.com/2014/10/23/garch11-model-in-python/
#https://onlinecourses.science.psu.edu/stat510/node/62
#http://statsmodels.sourceforge.net/devel/examples/notebooks/generated/tsa_arma.html
#http://cims.nyu.edu/~almgren/timeseries/Vol_Forecast1.pdf