Last answered:

07 Apr 2020

Posted on:

07 Apr 2020

0

ERROR in code: Fitting Higher Lag AR Models for Prices

The error exists even in the completed version of the notebook. Path:
Time Series Analysis in Python
The Autoregressive (AR) Model
Fitting Higher Lag AR Models for Prices Notebook:
Section 7 (Prices) - The AR Model - Completed
LLR Test
def LLR_test(mod_1, mod_2, DF = 1):
L1 = mod_1.fit().llf
L2 = mod_2.fit().llf
LR = (2*(L2-L1))
p = chi2.sf(LR, DF).round(3)
return p LLR_test(model_ar_2,model_ar_3)
ValueError: x contains a constant. Adding a constant with trend='c' is not allowed.
1 answers ( 0 marked as helpful)
Instructor
Posted on:

07 Apr 2020

0
Hey Akos,    This question has already been answered in the Q&A Hub. https://365datascience.com/question/comparing-higher-lag-ar-models/   Best, 365 Vik

Submit an answer