Course Name: Financial Time Series Analysis for Trading, Section No: 18, Unit No: 15, Unit type: Notebook
Hello, for this notebook we're calculating the best model based on AIC score. We used a function called select_model_and_forecast. For compatibility reasons I've changed some things in the function and added this extra line to check what was the best model to predict:
And while I was waiting for the model to finish I saw this:
The function, as we're applying it to a rolling column of a dataframe, is not using the same parameters to predict all the rows. It's using different ARIMA parameters for each prediction, while in most cases it predicts using p=2, d=1, q=2, in other cases it's using different parameters.
This can lead to unrealistic forecasts as we're dynamically changing the models parameters for everyday and not using always the same as we did in the previous notebooks.
How can we fix this? Maybe separating the AIC score selection model and then applying the forecast function with those parameters?
Also keep in mind the following:
The code inside of this notebook is incorrect as all prices are not being correctly processed. Please review the whole notebook with this issues.
This screenshot is taken from your notebook:
Hi Daniel,
We will check this and get back to you.
Thank you.
Hi Daniel,
The function is not using the same parameters to predict all the rows as it is learning from the latest data and finding the most optimal parameters on each iteration. Another way to approach this can be by fixing the parameter values based on a fixed set of data. But that would have a drawback of limiting the model to learn only on the basis of that fixed dataset.
Regarding your second point about the signal, we have updated the notebook. Now the model is predicting both the signals.
Hope this helps!
But this is practical in real life? I mean, we're looking an optimal model to predict, not too simple but not too complicated to avoid overfitting... How are the real models implemented in trading? Adjusting parameters everyday?it is learning from the latest data and finding the most optimal parameters on each iteration
Please clarify with me this point as I don't understand what's the point of today predicting using model 2,1,2 and tomorrow use 3,0,2 (for example).
Hi,
This is dependent on a variety of factors. If you are using daily data, then you can think of adjusting in a week or month. But if the data used is of higher frequency, then you will have to keep the timeframe shorter.
You can also look at volatility and the trend or seasonality pattern and adjust accordingly.
Hope this helps.