Search code examples
rforecasting

Plot of dshw does not place forecast data at the end of the sequence


I am using forecast 7.1. When I try to plot dshw it puts the forecasted data at the beginning of the graph instead of at the end of the training data.Forecast dshw

Anyone know how to fix this?


Solution

  • This is a bug, now reported on the github site for the package.

    Here is a workaround for a simple example.

    t <- seq(0,5,by=1/20)
    x <- exp(sin(2*pi*t) + cos(2*pi*t*4) + rnorm(length(t),0,.1))
    fc <- dshw(x,20,5)
    
    tspx <- tsp(fc$x)
    tspm <- tsp(fc$mean)
    tsp(fc$mean)[1:2] <- tspm[1:2] - tspm[1] + tspx[2]+1/tspx[3]
    plot(fc)