Automatic ARIMA models for seasonal time series
As you learned in the video, the auto.arima()
function also works with seasonal data. Note that setting lambda = 0
in the auto.arima()
function - applying a log transformation - means that the model will be fitted to the transformed data, and that the forecasts will be back-transformed onto the original scale.
After applying summary()
to this kind of fitted model, you may see something like the output below which corresponds with \((p,d,q)(P,D,Q)[m]\):
ARIMA(0,1,4)(0,1,1)[12]
In this exercise, you will use these functions to model and forecast the pre-loaded h02
data, which contains monthly sales of cortecosteroid drugs in Australia.
This exercise is part of the course
Forecasting in R
Exercise instructions
- Using the standard plotting function, plot the logged
h02
data to check that it has stable variance. - Fit a seasonal ARIMA model to the
h02
series withlambda = 0
. Save this tofit
. - Summarize the fitted model using the appropriate method.
- What levels of differencing were used in the model? Assign the amount of lag-1 differencing to
d
and seasonal differencing toD
. - Plot forecasts for the next 2 years by using the fitted model. Set
h
accordingly.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Check that the logged h02 data have stable variance
h02 %>% ___ %>% ___
# Fit a seasonal ARIMA model to h02 with lambda = 0
fit <- ___
# Summarize the fitted model
___
# Record the amount of lag-1 differencing and seasonal differencing used
d <- ___
D <- ___
# Plot 2-year forecasts
fit %>% ___ %>% ___