Using data UKDriverDeaths
Attempting to use Holt-Winters prediction function & ggplot().
Basically reproduce the data in ggplot.
data('UKDriverDeaths')
past <- window(UKDriverDeaths, end = c(1982, 12))
hw <- HoltWinters(past)
pred <- predict(hw, n.ahead = 10)
plot(hw, pred, ylim = range(UKDriverDeaths))
lines(UKDriverDeaths)
I'd like to show what holt winters predicts starting in 1983 against the actual data. The 2 problems are:
1) ggplot doesn't understand ts data.
2) Using HoltWinters() uses ts data, not zoo (dates or xts). I need the prediction & the actual data at the cut point to show (usually + geom_line(aes()) does this)
If confidence intervals were possible that would be great.
Thanks so much, absolutely stuck
I'm using
xts
to merge the data automatically.