Python Forum
Getting Residuals from AutoReg
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting Residuals from AutoReg
#1
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
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020