Last answered:

13 Apr 2021

Posted on:

28 Dec 2019

0

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?
4 answers ( 0 marked as helpful)
Instructor
Posted on:

30 Dec 2019

0
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! Best, Iliya
Instructor
Posted on:

02 Jan 2020

1

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 = mod_1.fit().llf
L2 = mod_2.fit().llf

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!

Best,
365 Vik

Posted on:

13 Apr 2021

0

Hello Viktor,
When using the results() instead of model(), the LLR test value is 1.0.
Can you shed some light on the theory behind this?

Posted on:

13 Apr 2021

0

Hello,
I think it might be because the simpler model comes first while testing LLR.

Submit an answer