Chapter 19 Time series & longitudinal data


19.1 Time series analysis

A common theme in data analysis…comparing multiple points in time.

See also

19.1.1 Theory and methods in R

19.1.1.1 Rob J Hyndman

Rob Hyndman’s work in this area is second-to-none.

Start with his book with George Athanasopoulos, Forecasting: Principles and Practice (3rd edition) (Hyndman and Athanasopoulos 2021)

19.1.1.2 Other authors

Avril Coghlan, Little Book of R for Time Series

Tavish Srivastava, 2015-12-16, “A Complete Tutorial on Time Series Modeling in R”

R - Time Series Analysis tutorial

Troy Walters, Time Series Analysis in R (series of blog posts at datascienceplus.com

Earo Wang, “Melt the clock: Tidy time series analysis” (presentation at RStudio conference, 2019)

19.1.1.3 Rolling averages, exponential smoothing, etc

Steph Locke, Understanding Rolling Calculations in R

Exponential Smoothing Models, UC Business Analytics R Programming Guide, 2017-10-16

19.1.2 {tsfeatures}

Methods for extracting various features from time series data

package

CRAN: tsfeatures: Time Series Feature Extraction

package webpage

articles

getting started article

19.1.3 {tsibble}

package

CRAN page: tsibble: Tidy Temporal Data Frames and Tools

github page: tsibble`: Tidy Temporal Data Frames and Tools

articles

Earo Wang, 2018-12-20, “Reintroducing tsibble: data tools that melt the clock”

Earo Wang and Dianne Cook and Rob J Hyndman, January 2019, “A new tidy data structure to support exploration and modeling of temporal data”(Wang, Cook, and Hyndman 2019)

19.1.4 {padr}

package

CRAN page: padr: Quickly Get Datetime Data Ready for Analysis

articles

Andrew Clark, 2017-07-19, padr package example

19.2 Forecasting

Forecasting methods extrapolate past trends. There is a wealth of material supporting the theory and methods around this, much of it coming from econometrics.

19.2.1 Theory and methods

Kamala Kanta Mishra, Selecting Forecasting Methods in Data Science (2017-02-13)

19.2.2 R

Rob J Hyndman and George Athanasopoulos, Forecasting: Principles and Practice, 3rd edition

Kostiantyn Kravchuk, “Forecasting: Time Series Exploration Exercises (Part-1)” (2017-04-10)

19.2.3 Base R

A variety of time series analysis tools are included in base R. These include:

19.2.3.1 HoltWinters()

19.2.4 {fable}

“…provides methods and tools for displaying and analysing univariate time series forecasts including exponential smoothing via state space models and automatic ARIMA modelling. Data, model and forecast objects are all stored in a tidy format.”

package

documentation: fable

19.2.5 {prophet}

package

CRAN page: prophet: Automatic Forecasting Procedure

documentation: Prophet: forecasting at scale

articles

“Prophet: How Facebook operationalizes time series forecasting at scale” at Revolutions Analytics (2017-02-24)


19.3 Longitudinal data

19.3.1 {brolgar}

{brolgar} website – BRowse Over Longitudinal Data Graphically and Analytically in R

Nick Tierney, 2019-08-13, Explore longitudinal data with brolgar


19.4 Seasonal adjustment

From the wikipedia entry:

Seasonal adjustment is a statistical method for removing the seasonal component of a time series that exhibits a seasonal pattern. It is usually done when wanting to analyse the trend of a time series independently of the seasonal components. It is normal to report seasonally adjusted data for unemployment rates to reveal the underlying trends in labor markets. Many economic phenomena have seasonal cycles, such as agricultural production and consumer consumption, e.g. greater consumption leading up to Christmas. It is necessary to adjust for this component in order to understand what underlying trends are in the economy and so official statistics are often adjusted to remove seasonal components.

Seasonal adjustment: wikipedia entry, 2016-05-07

19.4.1 Theory and methods

Statistics Canada, “Seasonal adjustment and trend-cycle estimation” (part of Statistics Canada Quality Guidelines, Catalogue 12-539-X)

U.S. Census Bureau, The X-13ARIMA-SEATS Seasonal Adjustment Program

19.4.2 R

19.4.2.2 {seasonal}

seasonal: R-interface to X-13ARIMA-SEATS

Packages the U.S. Census Bureau’s gold-standard X13-SEATS-ARIMA for use in R.

“…the best interface on the planet to the X13-SEATS-ARIMA time series analysis application from the US Census Department, which is the industry standard particularly for official statistics agencies doing seasonal adjustment.” (Peter Ellis, vignette for ggsdc)

package

CRAN page: seasonal: R Interface to X-13-ARIMA-SEATS’

github page: christophsax/seasonal

19.4.2.4 {x13binary}

(US Census Bureau X-13, packaged for easy loading. Loads as a dependency for most of the other seasonal adjustment packages.)

package

CRAN page: x13binary: Provide the ‘x13ashtml’ Seasonal Adjustment Binary


-30-

References

Hyndman, Rob J, and George Athanasopoulos. 2021. Forecasting: Principles and Practice. Third. OTexts: Melbourne, Australia. https://otexts.com/fpp3/.
Wang, Earo, Dianne Cook, and Rob J Hyndman. 2019. “A New Tidy Data Structure to Support Exploration and Modeling of Temporal Data.”