Plotting Confidence Intervals for Time Series

I found this tutorial here that shows how to plot time series and confidence intervals : dygraphs for R (scroll to bottom)

I tried to do this for a different class of models:


library(forecast)

# Fit the ARIMA model
fit <- auto.arima(ldeaths)

# Get the predictions with 95% confidence interval
pred <- forecast(fit, h=12, level=0.95)

library(dygraphs)

dygraph(cbind(ldeaths, pred$lower, pred$mean, pred$upper), main = "Deaths from Lung Disease (UK)") %>%
    dySeries("ldeaths", label = "Actual") %>%
    dySeries(c("pred$lower", "pred$mean", "pred$upper"), label = "Predicted", fill = "red")

Have I done this correctly?

Thanks!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.