Get startedGet started for free

Fixed rolling window forecast

Rolling-window forecasts are very popular for financial time series modeling. In this exercise, you will practice how to implement GARCH model forecasts with a fixed rolling window.

First define the window size inside .fit(), and perform the forecast with a for-loop. Note since the window size remains fixed, both the start and end points increment after each iteration.

The S&P 500 return series has been preloaded as sp_data, and a GARCH(1,1) model has been predefined in basic_gm. The start and end points of the initial sample window has been pre-defined in start_loc and end_loc respectively.

This exercise is part of the course

GARCH Models in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

for i in range(30):
    # Specify fixed rolling window size for model fitting
    gm_result = basic_gm.fit(first_obs = i + ____, 
                             last_obs = i + ____, update_freq = 5)
Edit and Run Code