Lag between Forecast and Actual Value

I am using a RandomForest to forecast the power in a wind turbine. The results are improving, but i'm getting a slight "lag" between the forecast and the value itself. Is there any way to correct this?

I am using the values of Generated Power, Wind Speed and Direction, as well as moving averages of these values to predict a 10 minute forecast.

Here is a picture of what I'm describing

• My guess is your model is suggesting generated power in the next hour will be close to generated power in the past hour, which is reasonable but perhaps not helpful and could explain the lag you are seeing. You might instead try to forecast the change in generated power; my guess is that it would appear to be a worse fit but might be more helpful – Henry Jun 16 '18 at 13:50
• @Henry, thanks for the answer. When you say the change in power, do you mean the difference between the current and future power, or the derivate? or both? – Andre Menor Jun 16 '18 at 18:50

Your model seems to be generating a noisy naive forecast i.e.:

$\hat{Y}_{t+1} = Y_t + Noise(t)$,

I don't think RF is a good approach for this.

You might want to try a random walk model which would be a more "intelligent" way of doing a naive forecast.

Or better still you might want to use Bayesian Structural Time Series since you data seems to be composed of local trends combined with sudden shifts in direction (i.e. structural breaks).

• Thank you, I'll try those approaches. I am working with R and only just begining in machine learning (this is my first project). Is there an R package that implements those models? Thank you in advance. – Andre Menor Jun 16 '18 at 18:40
• @AndreMenor yes. rwf() is part of the forecast package for random walk models and there's a BSTS package released by Google. – Skander H. Jun 18 '18 at 2:56

Just to update on my own question from weeks ago:

I did manage to make a decent forecast with the randomForest, without the "lag". It was a matter of feeding it more moving averages and variable lags. I'll post a work about it here, eventually.