Seasonal, subseries and lag plots
Today let's understand three plots that check something a single line chart cannot show you: whether a season repeats the exact same way every year, whether one quarter is quietly drifting away from the rest, and whether a value depends on what came before it.
Here is the running example for the whole lesson: quarterly beer production in Australia, from 1992 Q1 to 2010 Q2, in megalitres (a megalitre is a million litres). That's 74 quarters, published by the Australian Bureau of Statistics. Here is the whole series, plotted once, in full.
It rises and falls four times a year, every single year, for eighteen years straight. Build that same series properly, as a tsibble, and you can ask sharper questions of it. Press Run.
yearquarter("1992 Q1") + 0:73 builds all 74 quarter labels at once, starting at 1992 Q1 and counting up one quarter at a time. autoplot() is a shortcut that picks a sensible plot for whatever kind of object you hand it. Given a tsibble, it draws exactly the line you just saw in the widget above, time along the bottom and the value up the side.
The open question is whether that up-and-down wiggle is the exact same shape every year, or whether it drifts.
What counts as a season in this series
A season, in time series terms, is a calendar unit that repeats on a fixed clock: the same position shows up again after a fixed number of steps. A day has 24 hours that repeat every day. A week has 7 days that repeat every week. This series is recorded once every three months, four times a year, so its season is the quarter, and the number of steps in one full season, called the period, is 4.
beer still holds the tsibble you just built, so look at what it actually contains.
This beer object is a tsibble, short for tidy time series table: a data frame that also keeps track of which column is time and how far apart the rows are spaced. [1Q] is that spacing, printed right next to the row count: one quarter, with no gaps. <qtr> is the special type Quarter is stored as, so it prints as "1992 Q1" instead of a plain number.
The full series runs 74 rows, from 1992 Q1 to 2010 Q2. That's 18 full years, 1992 through 2009, plus the first two quarters of 2010: 18 years and 2 quarters. Across all of it, Beer ranges from 374 to 532 megalitres.