How it works...

In Step 2 to 4, we downloaded Google's daily stock prices and calculated simple returns. When working with (G)ARCH models, convergence warnings are likely to occur in the case of very small numbers. This is caused by instabilities in the underlying scipy's optimization algorithms. To overcome this issue, we multiplied the returns by 100 to express them as percentages.

In Step 5, we defined the ARCH(1) model. For the mean model, we selected the zero-mean approach, which is suitable for many liquid financial assets. Another viable choice here could be a constant mean.

In Step 6, we fitted the model, using the fit method. Additionally, we passed disp='off' to the fit method to suppress output from the optimization steps. To fit the model using the arch library, we had to take similar steps to the familiar scikit-learn approach: we first defined the model and then fitted it to the data. We printed the model's summary by using the summary method.

In Step 7, we also inspected the standardized residuals and the conditional volatility series by plotting them. The standardized residuals were computed by dividing the residuals by the conditional volatility. By passing annualize='D' to the plot method, we indicated that we wanted to annualize the conditional volatility series from daily data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.89.173