Time Series Analysis
2021-11-06
Preface
These notes are based on the Time Series with R skill track at DataCamp and Rob Hyndman’s Forecasting: Principles and Practice (Rob J Hyndman 2021). I organized them into a section on working with a tsibble
(time series tibble) (chapter 1), a section on data exploration (chapter 2), and then four sections on models.
Forecasts aren’t necessarily based on time series models - you can perform a cross-sectional regression analysis of features, possibly including time-related features such as month of year (chapter 3). Time series forecasts are a specific type of forecast based, at least in part, on the assumption that future outcomes are functionally dependent upon prior outcomes. In most cases the objective of a time series forecast is to project a time series. In these cases, the forecast either decomposes a time series into trend and seasonality components (exponential smoothing models, chapter 4) or describes the autocorrelation within the data (ARIMA models, chapter 5). There may also be cases where you include other predictor variables (dynamic models, chapter 6).
In addition to the standard packages, these notes use the tsibble
, feasts
, fable
, and tsibbledata
packages.
library(tidyverse)
library(lubridate)
library(patchwork) # arranging plots
library(glue)
library(tsibble)
library(feasts) # feature extraction and statistics
library(fable) # forecasting
library(tsibbledata)