ダイグラフパッケージを使用して、これに対する非常に簡単な解決策が見つかりました。これは、他の初心者が遭遇包みここに答えると同じことをやろうとしている/シンプルなものになるが、私の質問を残すことがあります。 https://rstudio.github.io/dygraphs/gallery-upper-lower-bars.html
:私はこのリンクから(第二グラフ)のコードを取っ
これに変更しました:
library(dygraphs)
library(magrittr)
#hw <- HoltWinters(ldeaths)
hw <- HoltWinters(window(ldeaths, 1974, c(1976,12))) #subset timeseries to first 3 years in ldeath (train data)
p <- predict(hw, n.ahead = 36, prediction.interval = TRUE) #predict for the last 3 years in ldeath (test data)
all <- cbind(ldeaths, p) #we add full ldeaths into graph to see test data (1977,78,79) against the prediction
dygraph(all, "Deaths from Lung Disease (UK)") %>%
dySeries("ldeaths", label = "Actual") %>%
dySeries(c("p.lwr", "p.fit", "p.upr"), label = "Predicted")
出典
2017-08-05 02:11:06
JD1