I'm trying to plot forecast and real data on the same plot. But there is always gap between them on the image :
I use for the forecasting following code: y=boardings[,1] ## Simple Exponential smoothing #predict existing values results=HoltWinters(y,beta=FALSE, gamma=FALSE) #print data print(cbind(y,results$fitted)) #draw the plot with fitted values plot(results) #predict future values results2=forecast.HoltWinters(results,h=12) print(results2)
#draw the plot with prediction plot.forecast(results2,lwd=1,xlab='time',ylab='log.boardings',main='12-month prediction by Exponential Smoothing')
The data is taken from the timeSeries package with name
I would really appreciate any help.