Python Forum

Full Version: Getting Residuals from AutoReg
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

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