Apr-08-2021, 12:39 PM
Hello,
I am trying to get the residuals from the AutoReg function from StatsModels but it outputs NaNs:
Matt
I am trying to get the residuals from the AutoReg function from StatsModels but it outputs NaNs:
from statsmodels.tsa.ar_model import AutoReg df = stock['Close'] / stock['Close'].shift(1) - 1 df = df.dropna() model = AutoReg(df, lags=1, old_names=False).fit() res_values = model.resid res_values
Output:Out[12]:
Date
2010-03-05 NaN
2010-03-09 NaN
2010-03-10 NaN
2010-03-11 NaN
2010-03-12 NaN
..
2021-04-02 NaN
2021-04-05 NaN
2021-04-06 NaN
2021-04-07 NaN
2021-04-08 NaN
Length: 2775, dtype: float64
I'm not proficient in StatsModels or statistics so I'm sure my mistake is novice but I can't seem to find an answer why.Matt