Question
How can I draw a plot in R, showing the Holt Winters predict interval combine with observed/fitted data? I need to produce a figure looks
How can I draw a plot in R, showing the Holt Winters predict interval combine with observed/fitted data? I need to produce a figure looks like the one I uploaded. Flu data is a .csv file so I can't upload it
Figure comes from applying the simple exponential smoothing
algorithm to the flu data and using the predict.HoltWinters
function to construct a 95%-prediction interval for one year ahead.
Reproduce Fig. 1
data import code:
ILI.file <- read.csv(file= "Assignment1DataFlu.csv", header=TRUE)
ILI <- ILI.file[, 2]
ILI <- ts(ILI, start=2008+39/52, frequency = 52)
I used following code, but it doesn't work to produce the right figure:
ILI.hw <- HoltWinters(ILI)
ILI.hw.predict <- predict(ILI.hw,n.ahead=52*1,level=0.95)
plot(ILI.hw,ILI.hw.predict)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started