Solved – Delay issue in time series prediction

MATLABneural networkstime series

I am having an issue using neural networks to predict time series. Some predicted data fits with the expected data, as bellow: (In black the real time series and in blue the output of my neural network)

Australia energy demand
Time serie: Australia energy demand.

But with the same code, with other time series, the predicted data does not fits with the expected data, and has a delay of one unit, as bellow:

enter image description here
Time serie: Walmart Stock price.
enter image description here
Time serie: Dollar libra exchange.

I found some articles about some variations of neural networks and at the results section shows the plot with the delay like my results, as bellow:

enter image description here
Time serie: Dollar libra exchange.
(Article link: http://www.sciencedirect.com/science/article/pii/S1877050915015793)

Anyone knows if this is a common behavior or can be something wrong with my code ? I am having this issue about three months ago, and since there I am trying to figure out some bug in my code but is all right.

Thanks and I appreciate any tip.

Best Answer

Something could always be wrong with your code, but this type of behavior would be consistent with a model that was similar to a random walk.

A random walk (without drift) would be specified as follows; $$ y_t = y_{t-1} + \varepsilon_t $$ where $E[e_t] = 0$. Thus $E[Y_t|y_1,...,y_{t-1}] = y_{t-1}$. So when you graph your predictions against actual observations, it will look as though your predictions are delayed by one unit, when in fact the forecasts are just using the contemporaneous observation as next periods prediction.

Not knowing anything else about your neural network model and code, my best guess would be that the model converged on something similar to a random walk (the graph does suggest that there are additional trend/drift components at work too though).

Related Question