I have a time series $X_t$ generated from a standard GBM

$$dS_t = \mu S_t dt + \sigma S_t dW_t$$

If I take the log returns over a rolling window of length $l$

$$r^{(l)}_i = \log \left( \frac{S_i}{S_{i-l}} \right)$$

then the $r^{(l)}_i$'s will be highly autocorrelated.

For example, in python, we can calculate a 5 day rolling return ($l=5$) by

df  # pandas dataframe
>>> date    price
2006-03-01  65.72
2006-03-02  62.91

df["rolling_5_day_returns"] = np.log(df["price"].shift(-5)) - np.log(df["price"])

Given the autocorrelation, is there any technical issue in training a model $f$ to estimate the return $\hat r_{i + l}$ at time $i$? That is, at time $i$ we will have an estimate of price difference between times $i$ and $l$.

Explicitly, we have

$$ f(\vec r^{(l)}_i) = \hat r_{i+l} =\log \left( \frac{S_{i+l}}{S_i} \right) $$ $$ f(\vec r^{(l)}_{i+1}) = \hat r_{i+l+1} =\log \left( \frac{S_{i+l+1}}{S_{i+1}} \right) $$ $$ ... $$

where $\vec r^{(l)}_i$ is a vector of historic rolling window returns up to and including time $i$, and $ \hat r_{i+l}$ is the estimate of the return between the current time $i$ and future time $i+l$.

EDIT: When I say technical issue I mean, is it incorrect to train a model on such data, or will the model suffer in performance if the data is autocorrelated?

Also, I plan to train an LSTM model, but should it matter what model we train whether it's a neural net, regression or ARIMA? The data is always the same.

  • 1
    $\begingroup$ What do you mean by "technical issue"? Which kind of model do you plan to apply? Classical times series models or feature based ml models? $\endgroup$
    – Richi Wa
    Jan 24, 2020 at 8:57
  • $\begingroup$ @Ric I mean is it incorrect to train a model on such data, or will the model suffer in performance if the data is autocorrelated. I plan to train an LSTM model - should it matter whether we are training a neural net, regression, or ARIMA model? The data is always the same $\endgroup$
    – PyRsquared
    Jan 24, 2020 at 10:17
  • $\begingroup$ Classical models provide both an estimate and a range of uncertainty (or confidence interval) around that estimate. The confidence interval requires special techniques if autocorrelation is present, the usual method will underestimate the uncertainty in that case. (Looked at another way, the fact that you use overlapping observations means you have fewer "true" degrees of freedom than observations, and that needs to be taken into account in estimating the uncertainty). $\endgroup$
    – nbbo2
    Jan 24, 2020 at 13:14

1 Answer 1


If you are predicting the return from time "i" to time "i+l" then you cannot use any information beyond time "i" to train your model. As it appears you are getting returns from "i-5" to "i" and assuming that this same relationship will hold into the future from day "i" to "i+5". In theory there is nothing glaringly bad about this approach, but I would probably advise you, to be conservative, to get the return from "i-6" to "i-1", and then use this to predict the return from "i" to "i+5" to avoid problem of knowing the return at the close of day "i", and then instantly transacting in the same stock right away. I would also suggest reading up on basic momentum strategies, where you use past returns to predict future returns. Good luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.