The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Anybody can ask a question
Anybody can answer
The best answers are voted up and moderated by our team

Time series Analysis In Python Section 7 Jupyter Notebook doesn’t work

Time series Analysis In Python Section 7 Jupyter Notebook doesn’t work


For the LLR test part, the function doesn’t work, I tried to download the new file and it still doesn’t work, can anyone help me with this?

2 Answers

365 Team

Hi Keyu,
Thanks for reaching out!
If you remove the “.fit()” from the LLR test function, you have to use the already fitted “results” variables instead of the “model” ones.
Hope this helps!

Hi, Iliya, I did not remove the “.fit()” from the LLR test function, this is what I got with the completed version of the file and I did not change anything att all. would you mind write down the code in this comment section?

6 months

365 Team

Hey Keyu,

Sorry for the delayed response, but I was out of the office over the festive period.

Anyhow, the issue here comes from the release of a newer version of statsmodels than the one the code was initially created on. The simplest solution is the what Iliya had already advised – remove “.fit()” and use the “results” variables over the “model” variables.
In other words, rewrite the LLR_test function to use:

L1 = mod_1.llf
L2 = mod_2.llf

rather than:

L1 =
L2 =

Then, when you actually call the function, you’d be using the “results” variables, so:

LLR_test(results_ar_2, results_ar_3)

instead of:

LLR_test(model_ar_2, model_ar_3)

Python returns an error when fitting the same model twice, so we work around this issue by using the fitted results in the LLR_test instead.

Hope this helps!

365 Vik

Learn Data Science
this Summer!
Get 50% OFF