Week 3: Time series decomposition

Tutorial exercises

What you will learn this week

  • Transforming data to remove some sources of variation
  • Decomposing a time series into trend-cycle, seasonal and remainder components
  • Seasonal adjustment

Pre-seminar activities

Read Chapter 3 of the textbook and watch all embedded videos

Slides for seminar

Download pdf

Lectorial activities

  1. Find an appropriate Box-Cox transformation in order to stabilise the variance for Gas production from aus_production.

  2. Why is a Box-Cox transformation unhelpful for the canadian_gas data?

  3. Produce the following decomposition for the number (in thousands) of of people employed in Retail Trade in the US

    us_retail_employment <- us_employment |>
      filter(year(Month) >= 1990, Title == "Retail Trade") |>
      select(-Series_ID)
    
    dcmp <- us_retail_employment |>
            model(stl = STL(Employed)) 
    1. Plot the decomposition.

    2. Fit the trend component over the data [Hint: you can use autolayer() to add trend to the plot above. trend is one of the variables returned by STL(). ]

    3. Fit the trend and the seasonally adjusted [Hint: seas_adjust is one of the variables returned by STL. ]

    4. How does the seasonal shape change over time? [Hint: Try plotting the seasonal component using gg_season().]

    5. What happens as you change the values of the two window arguments?

    6. Can you produce a plausible seasonally adjusted series?

  4. Exam 2024

    • Section A: Q6 (just for information at the moment)
    • Section B: Q1, Q2

Seminar code

Assignments

  • GA1 is due on Monday 24 March.