Aan de slagGa gratis aan de slag

Searching over model order

In this exercise you are faced with a dataset which appears to be an ARMA model. You can see the ACF and PACF in the plot below. In order to choose the best order for this model you are going to have to do a search over lots of potential model orders to find the best set.

<\center>

The ARIMA model class and the time series DataFrame df are available in your environment.

Deze oefening maakt deel uit van de cursus

ARIMA Models in Python

Cursus bekijken

Oefeninstructies

  • Loop over values of p from 0-2.
  • Loop over values of q from 0-2.
  • Train and fit an ARMA(p,q) model.
  • Append a tuple of (p,q, AIC value, BIC value) to order_aic_bic.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Create empty list to store search results
order_aic_bic=[]

# Loop over p values from 0-2
for p in range(____):
  # Loop over q values from 0-2
    for q in range(____):
      	# create and fit ARMA(p,q) model
        model = ARIMA(df, order=____)
        results = model.fit()
        
        # Append order and results tuple
        order_aic_bic.append((____))
Code bewerken en uitvoeren