Overview

feasts provides a collection of tools for the analysis of time series data. The package name is an acronym comprising of its key features: Feature Extraction And Statistics for Time Series.

The package works with tidy temporal data provided by the tsibble package to produce time series features, decompositions, statistical summaries and convenient visualisations. These features are useful in understanding the behaviour of time series data, and closely integrates with the tidy forecasting workflow used in the fable package.

Installation

You could install the stable version from CRAN:

You can install the development version from GitHub with:

Usage

library(feasts)
library(tsibbledata)
library(dplyr)
library(ggplot2)
library(lubridate)

Graphics

Visualisation is often the first step in understanding the patterns in time series data. The package uses ggplot2 to produce customisable graphics to visualise time series patterns.

aus_production %>% filter(year(Quarter) > 1991) %>% gg_lag(Beer)

Feature extraction and statistics

Extract features and statistics across a large collection of time series to identify unusual/extreme time series, or find clusters of similar behaviour.

This allows you to visualise the behaviour of many time series (where the plotting methods above would show too much information).

aus_retail %>%
  features(Turnover, feat_stl) %>%
  ggplot(aes(x = trend_strength, y = seasonal_strength_year)) +
  geom_point() +
  facet_wrap(vars(State))

Most of Australian’s retail industries are highly trended and seasonal for all states.

It’s also easy to extract the most (and least) seasonal time series.

extreme_seasonalities <- aus_retail %>%
  features(Turnover, feat_stl) %>%
  filter(seasonal_strength_year %in% range(seasonal_strength_year))
aus_retail %>%
  right_join(extreme_seasonalities, by = c("State", "Industry")) %>%
  ggplot(aes(x = Month, y = Turnover)) +
  geom_line() +
  facet_grid(vars(State, Industry, scales::percent(seasonal_strength_year)),
             scales = "free_y")