Week 11: Dynamic regression
What you will learn this week
- How to combine regression models with ARIMA models to form dynamic regression models
- Dynamic harmonic regression to handle complex seasonality
- Lagged predictors
Pre-class activities
Read Chapter 10 of the textbook and watch all embedded videos
Exercises (on your own or in tutorial)
Complete Exercises 1-7 from Section 7.10 of the book.
Slides for seminar
Seminar activities
Repeat the daily electricity example, but instead of using a quadratic function of temperature, use a piecewise linear function with the “knot” around 20 degrees Celsius (use predictors Temperature
& Temp2
). How can you optimize the choice of knot?
The data can be created as follows.
<- vic_elec |>
vic_elec_daily filter(year(Time) == 2014) |>
index_by(Date = date(Time)) |>
summarise(
Demand = sum(Demand)/1e3,
Temperature = max(Temperature),
Holiday = any(Holiday)
|>
) mutate(
Temp2 = I(pmax(Temperature-20,0)),
Day_Type = case_when(
~ "Holiday",
Holiday wday(Date) %in% 2:6 ~ "Weekday",
TRUE ~ "Weekend"
) )
Repeat but using all available data, and handling the annual seasonality using Fourier terms.
Assignments
- Retail Project is due on Friday 24 May.