# How can the different r2 score of an AR(1) model on prices vs. returns be explained

This is maybe a silly question, but I want to understand. As far as I understand an AR(1) model, it is basically a linear regression model with the same but lagged variable, right?

However I am wondering how the different results can be explained when we apply an OLS on the lagged price time series vs. on the return time series.

See this experiment in python:

from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
import yfinance

train_lagged_price = spydf[["Close"]][:-200].shift(1).dropna().values
train_price = spydf["Close"][:-201].values
test_lagged_price = spydf[["Close"]][-201:].shift(1).dropna().values
test_price = spydf["Close"][-200:].values

lm_price = LinearRegression().fit(train_lagged_price, train_price)
r2_price = r2_score(test_price, lm.predict(test_lagged_price))

train_lagged_returns = spydf[["Close"]].pct_change()[1:-200].shift(1).dropna().values
train_returns = spydf["Close"].pct_change()[1:-201].values
test_lagged_returns = spydf[["Close"]].pct_change().dropna()[-201:].shift(1).dropna().values
test_returns = spydf["Close"].pct_change()[-200:].values

lm_returns = LinearRegression().fit(train_lagged_returns, train_returns)
r2_returns = r2_score(test_returns, lm.predict(test_lagged_returns))

r2_price, r2_returns == 0.9333725796827039, -1.6887830366573184


We get 2 totally different r2 scores and I would like to explain this difference.

• Prices are not stationary, the basic premise for an AR(1) is not satisfied. So the R2 of your AR(1) on prices does not mean anything – phdstudent Aug 8 '20 at 12:56
• Given $P_0$ the distribution of the (unknown) $P_1$ is quite narrow, the distribution of $P_2$ is a little broader, ..., the distribution of $P_{100}$ is quite broad (since the price could have moved up or down a lot in 100 periods). So you can see that $P_t$ is not independent of t, i.e. the distribution is not stationary, it is changing in time. – noob2 Aug 8 '20 at 14:38
• OTOH the R2 on returns of -1.689 looks rather odd also, I would have expected near 0 – noob2 Aug 8 '20 at 15:05
• Ah, it's difficult to read, however... the $R^2$ values are out-of-sample, so you can get values outside of $[0,1]$. The first $R^2$ is nonsense, as pointed out. the second $R^2$ is valid but says that the model adds noise: we could do better at predicting without an AR(1) term. – kurtosis Aug 8 '20 at 18:46