# Lag between predicted output and real output in time series prediction (directional prediction)

I modeled a directional prediction of a time series. In every step, I predict next direction of that series (up or down). Currently I have a lag in predicted outputs compared to real outputs.

For example, in above outputs, first figure is real direction and second figure is predicted direction (red star: next up trend, blue star: next down trend). So we can see that in prediction outputs we have 1-step lag. Totally, I have better results If I don't have this lag in prediction. I saw this link which mentions that this is a problem related to "naive predictor". We have same behavior in this problem (inputs: different lags of time series, output: 1 or 0)? How can I resolve that? Currently, I'm using logistic regression in this model.

• I checked my input data using unit root test. The input data was non-stationary so I transformed it to stationary using different methods (difference,detrend, etc.) but I have same problem. Is this same problem mentioned HERE?

If the data generating process is a random walk, $$x_t = x_{t-1} + \varepsilon_t$$ with $\varepsilon_t \sim i.i.d.(0,\sigma^2)$, the optimal* one-step-ahead prediction is $$\hat x_{t+1|t}:=\mathbb{E}(x_{t+1}|x_{t},x_{t-1},\dots)=x_{t}$$ which happens to be the realization $x_{t+1}$ lagged by one ($x_t$ is $x_{t+1}$ lagged by 1). Given the data generating process, this apparently lagging prediction is the best we can get*. Then there is no way we can "fix" the "problem of lagging predictions; the problem is built-in due to the nature of the data generating process.