%>% autoplot(y) + ggtitle("Add you title here") +
myts ylab("add y label")
Group Assignment 3: Suggested Solutions & Feedback
For the tasks that follow you will be modelling the original data without any transformation performed (even if you previously deemed it necessary).
Question 1
Plot your time series. By observing the plot and describing its components select an ETS model you think is appropriate for forecasting. Make sure you justify your choice (no more than 150 words). (8 marks)
Marking guide:
- Plot: labels, units and heading. (1m)
- Choose an ETS model (1m)
- Justify the choice for trend (damped or not). (2m)
- Justify the choice for seasonal. (2m)
- Justify the choice for error. (2m)
- -2: Exceeding word limit.
Question 2
Search for an ETS model for your series using appropriate information criteria. Describe the process you have implemented. Which part of the data have you used? Which model have you selected and why? Show all necessary output (10 marks)
<- myts %>% model(ETS(y))
ETS_AICc options(digits=4)
%>% report() ETS_AICc
Series: y
Model: ETS(M,A,M)
Smoothing parameters:
alpha = 0.4515
beta = 0.005397
gamma = 0.0812
Initial states:
l[0] b[0] s[0] s[-1] s[-2] s[-3] s[-4] s[-5] s[-6] s[-7] s[-8] s[-9]
44.66 0.02682 0.9823 0.8902 1.007 1.446 1.06 1.026 0.952 0.9372 0.9028 0.8941
s[-10] s[-11]
0.9409 0.9614
sigma^2: 0.0028
AIC AICc BIC
4960 4961 5031
%>% components() %>% autoplot() ETS_AICc
Warning: Removed 12 rows containing missing values or values outside the scale range
(`geom_line()`).
Marking guide:
- Show estimated model output and describe it. (4)
- Automated model selection is implemented, the model with the lowest AICc is selected (2)
- amongst the 15 stable models. (2)
- Hence the whole data set is used (2)
Question 3
Now use time series cross-validation to compare the model selected from the previous step, along with ETS(M,N,M), ETS(M,A,M) and ETS(M,Ad,M) models. You will need to think about more than h=1 step-ahead. Think about an appropriate range of forecast horizons and justify your choice. Fully describe the process you have implemented. Show all necessary output. (Hint the code add the end of this section https://otexts.com/fpp3/tscv.html may help you to get started.) (22 marks)
=24 # Can choose something larger here
h
<-myts %>%
fc stretch_tsibble(.init = nrow(myts)-240) %>%
filter(.id < max(.id)+1-h) %>% # Remove the last fold (we don't have test data for this one!)
model(
MAM= ETS(y ~ error("M") + trend("A") + season("M")),
ETS_AICc = ETS(y ~ error("M") + trend("Ad") + season("M")),
MNM = ETS(y ~ error("M") + trend("N") + season("M"))
%>%
) forecast(h = h) %>%
group_by(.id,.model) %>%
mutate(h = row_number()) %>%
ungroup() %>%
as_fable(response = "y", distribution = y)
%>%
fc accuracy(myts, by = c("h", ".model")) %>%
ggplot(aes(x = h, y = RMSE)) +
geom_point(aes(colour=.model))
Marking guide:
- Clrearly state details of the cross-validation:
- window type (2), .init or .size depending on window type in combination with h (3), .step (1) and what h are you using (see below for h)? (6)
- I would expect h=1-12 minimum to get full marks (at least one year ahead). Best to do 1-24. (8)
- show accuracy table/plot (8)
Question 4
Which model do you prefer for your data? Choose a model and briefly explain your choice. Plot and describe its components and comment on the estimated parameters and how these are appropriate for your data. Perform all the necessary diagnostic checks and comment. (max 400 words) (14 marks)
- which model and why (4) (Check all error measure to make a chioce. Remember RMSE and AICc are equivalent for h=1 and large T so mostly these will agree how about other measures?)
- describe the model commenting on components, parameters and appropriatness (6)
- check residual diagnostics, gg_tsresiduals and LB test (4) (critically evaluate these)
<- myts %>% model(ETS(y))
ETS_AICc options(digits=4)
%>% report() ETS_AICc
Series: y
Model: ETS(M,A,M)
Smoothing parameters:
alpha = 0.4515
beta = 0.005397
gamma = 0.0812
Initial states:
l[0] b[0] s[0] s[-1] s[-2] s[-3] s[-4] s[-5] s[-6] s[-7] s[-8] s[-9]
44.66 0.02682 0.9823 0.8902 1.007 1.446 1.06 1.026 0.952 0.9372 0.9028 0.8941
s[-10] s[-11]
0.9409 0.9614
sigma^2: 0.0028
AIC AICc BIC
4960 4961 5031
%>% components() %>% autoplot() ETS_AICc
Warning: Removed 12 rows containing missing values or values outside the scale range
(`geom_line()`).
Question 5
Generate forecasts for the two years following the end of your sample using your chosen/best model. Plot them and briefly comment on these. (No more than 100 words). (4 marks)
%>%
myts model(ETS(y ~ error("M") + trend("N") + season("M"))) %>%
forecast() %>%
autoplot(myts)
This is straight forward. - Plot forecasts for h=24 on original scale. The x-axis and y-axis label must be appropriate, else deduct 1m. (2m) - Comment on the point forecasts and prediction intervals (2m)