Time series Analysis In Python Section 7 Jupyter Notebook doesn't work
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
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?
Hello,
I think it might be because the simpler model comes first while testing LLR.