# Feedforward net lagged prediction

I am trying to predict y(t+1) of a function by using a feedforward neural network with Matlab. The inputs are the previous 3 previous values (y(t-2), y(t-1), y(t)) and the training output is the actual value I want to predict y(t+1).

The "prediction" seems perfect! The output seems like a perfect copy of the original graph. BUT, the output is shifted. So it doesn't look like it's predicting, but actually taking y(t) (one of my inputs) as the output everytime and it's not predicting but shifted.

Here's the graph (the red one is the 'prediction'

What causes this behavior?? How can I fix this? I have no idea what's going on, I even tried with NARX and the same thing happens..... any suggestions?

• You haven't given nearly enough information to allow us to answer the question. It sounds a lot like you're asking for help debugging a Matlab program, but you haven't even said what the program is. However, debugging code is off-topic, here. Can you clarify exactly what you're looking for and give enough information so that people can tell what you're doing? Jun 28 '15 at 11:12
• I basically used all the default settings, so there's no code to debug. Using the neural network toolbox to train the network.This is not a debugging question, but more of a question to understand more the dynamics of neural networks and possible reasons why this problem is caused. Jun 28 '15 at 11:15
• OK, in that case, it's specific to Matlab's default implementation of neural nets. Migration to Computational Science would probably be appropriate. Jun 28 '15 at 11:19
• Please don't repost. I've flagged for migration so this post will be moved over there. Jun 28 '15 at 11:23

The reason it looks like it's just shifted is an illusion. One step prediction plots can be very deceiving for the unseasoned. Basically what's happening is that your time series is not very predictable, and the model is spitting something very close to the last data point. Your model is close to $y(t+1) = y(t) + \epsilon$. Therefore, the prediction looks like it's shifted to the future by 1.