erykml / Python-for-Finance-Cookbook-2E

The repository of "Python for Finance Cookbook" 2nd edition
MIT License
174 stars 129 forks source link

# Chapter_6: example codes return different plots compared with those plots on the textbook. #4

Open FrankManc opened 1 year ago

FrankManc commented 1 year ago

Hi, I am trying to reproduce the plots from Chapter 6 on the textbook. I got everything pretty much the same as what presented on the textbook, however, there is only one plot reproduced in a different way.

That is when we train ARIMA model with additional features (exogenous variables). The example code does not return the expected plots.

image

This is reproduced one by running the example codes. The codes works perfect and do not report any errors. What is really strange is that even if I do not put exogenous variables in the model, the model returns the exactly the same thing.

In this case, I think that exogenous variable itself might not wokring.

Thanks

erykml commented 1 year ago

Hi! The best way to see if the external features were incorporated into the model is to print the summary of the fitted model. If the external regressors were used, you will see them there, together with their coefficients, etc. From what I can see, they are correctly incorporated. Please let me know if you have any more doubts!

FrankManc commented 1 year ago

Yes, I totally agree with what you said. I checked the summary of the fitted model, I found that the external regressors were not used by the model even if I set the exogenous variables. More importantly, I used the code that you provided on the Github, which returns me the same result.

The strangest thing is that I can see that are correctly incorporated but actually they are not. Can you just try to run the Chapter 6 codes on your computer please?

erykml commented 1 year ago

Hey @FrankManc, apologies for the late reply. When I inspect the outcome of step 3 in the There's more section of the last recipe, I see the following summary output:

image

Did you manage to solve the issue? Also, can you check explicitly before running that cell that the DataFrame actually contains the external regressors?