Time Series Patterns

Vocabulary for describing visual structure in time series.

Kris Sankaran (UW Madison)
01-10-2023

Reading, Recording, Rmarkdown

  1. There are a few structures that are worth keeping an eye out for whenever you plot a single time series. We’ll review the main vocabulary in these notes.

  2. Vocabulary

    • Trend: A long-run increase or decrease in a time series.
    • Seasonal: A pattern that recurs over a fixed and known period.
    • Cyclic: A rising and falling pattern that does not occur over a fixed or known period.

A few series with different combinations of these patterns are shown below.

ggplot(as_tsibble(qauselec)) +
  geom_line(aes(x = index, y = value)) +
  labs(title = "Australian Quarterly Electricity Production")
ggplot(as_tsibble(hsales)) +
  geom_line(aes(x = index, y = value)) +
  labs(title = "Housing Sales")
ggplot(as_tsibble(ustreas)) +
  geom_line(aes(x = index, y = value)) +
  labs(title = "US Treasury Bill Contracts")
ggplot(as_tsibble(diff(goog))) +
  geom_line(aes(x = index, y = value)) +
  labs(title = "Google Stock Prices")

  1. A series can display combinations of these patterns at once. Further, the same data can exhibit different patterns depending on the scale at which it is viewed. For example, though a dataset might seem seasonal at short time scales, a long-term trend might appear after zooming out. This is visible in the electricity production plot above.

  2. Finally, it’s worth keeping in mind that real-world structure can be much more complicated than any of these patterns. For example, the plot below shows the number of passengers on flights from Melbourne to Sydney between 1987 and 1992. You can see a period when no flights were made and a trial in 1992 where economy seats were switched to business seats.

melbourne_sydney <- ansett %>%
  filter(Airports == "MEL-SYD") # challenge: facet by Airports, instead of filtering

ggplot(melbourne_sydney) +
  geom_line(aes(x = Week, y = Passengers, col = Class))

Citation

For attribution, please cite this work as

Sankaran (2023, Jan. 10). STAT 436 (Spring 2023): Time Series Patterns. Retrieved from https://krisrs1128.github.io/stat436_s23/website/stat436_s23/posts/2022-12-27-week06-02/

BibTeX citation

@misc{sankaran2023time,
  author = {Sankaran, Kris},
  title = {STAT 436 (Spring 2023): Time Series Patterns},
  url = {https://krisrs1128.github.io/stat436_s23/website/stat436_s23/posts/2022-12-27-week06-02/},
  year = {2023}
}