• Stars
    star
    155
  • Rank 240,864 (Top 5 %)
  • Language
    R
  • Created over 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Extending broom for time series forecasting

sweep

codecov CRAN_Status_Badge

Extending broom to time series forecasting

The sweep package extends the broom tools (tidy, glance, and augment) for performing forecasts and time series analysis in the “tidyverse”. The package is geared towards “tidying” the forecast workflow used with Rob Hyndman’s forecast package.

Benefits

  • Designed for modeling and scaling forecasts using the the tidyverse tools in R for Data Science
  • Extends broom for model analysis (ARIMA, ETS, BATS, etc)
  • Tidies the forecast objects for easy plotting and “tidy” data manipulation
  • Integrates timetk to enable dates and datetimes (irregular time series) in the tidied forecast output

Tools

The package contains the following elements:

  1. model tidiers: sw_tidy, sw_glance, sw_augment, sw_tidy_decomp functions extend tidy, glance, and augment from the broom package specifically for models (ets(), Arima(), bats(), etc) used for forecasting.

  2. forecast tidier: sw_sweep converts a forecast object to a tibble that can be easily manipulated in the “tidyverse”.

Making forecasts in the tidyverse

sweep enables converting a forecast object to tibble. The result is ability to use dplyr, tidyr, and ggplot natively to manipulate, analyze and visualize forecasts.

Forecasting multiple time series groups at scale

Often forecasts are required on grouped data to analyse trends in sub-categories. The good news is scaling from one time series to many is easy with the various sw_ functions in combination with dplyr and purrr.

Forecasting multiple models for accuracy

A common goal in forecasting is to compare different forecast models against each other. sweep helps in this area as well.

broom extensions for forecasting

If you are familiar with broom, you know how useful it is for retrieving “tidy” format model components. sweep extends this benefit to the forecast package workflow with the following functions:

  • sw_tidy: Returns model coefficients (single column)
  • sw_glance: Returns accuracy statistics (single row)
  • sw_augment: Returns residuals
  • sw_tidy_decomp: Returns seasonal decompositions
  • sw_sweep: Returns tidy forecast outputs.

The compatibility chart is listed below.

Object sw_tidy() sw_glance() sw_augment() sw_tidy_decomp() sw_sweep()
ar
arima X X X
Arima X X X
ets X X X X
baggedETS
bats X X X X
tbats X X X X
nnetar X X X
stl X
HoltWinters X X X X
StructTS X X X X
tslm X X X
decompose X
adf.test X X
Box.test X X
kpss.test X X
forecast X

Function Compatibility

Installation

Here’s how to get started.

Development version with latest features:

# install.packages("devtools")
devtools::install_github("business-science/sweep")

Further Information

The sweep package includes several vignettes to help users get up to speed quickly:

  • SW00 - Introduction to sweep
  • SW01 - Forecasting Time Series Groups in the tidyverse
  • SW02 - Forecasting Using Multiple Models

More Repositories

1

free_r_tips

Free R-Tips is a FREE Newsletter provided by Business Science. It comes with bite-sized code tutorials every week.
HTML
1,267
star
2

tidyquant

Bringing financial analysis to the tidyverse
R
850
star
3

pytimetk

Time series easier, faster, more fun. Pytimetk.
Python
673
star
4

timetk

Time series analysis in the `tidyverse`
R
608
star
5

modeltime

Modeltime unlocks time series forecast models and machine learning in one framework
R
515
star
6

anomalize

Tidy anomaly detection
R
337
star
7

tibbletime

Time-aware tibbles
R
179
star
8

presentations

A central repository of Business Science presentations
HTML
165
star
9

correlationfunnel

Speed Up Exploratory Data Analysis (EDA)
R
132
star
10

cheatsheets

101
star
11

free_python_tips

HTML
79
star
12

modeltime.ensemble

Time Series Ensemble Forecasting
R
73
star
13

alphavantager

A lightweight R interface to the Alpha Vantage API
R
69
star
14

riingo

An R interface to the Tiingo stock price API
R
51
star
15

10_python_r_business_problems

Python
48
star
16

modeltime.h2o

Forecasting with H2O AutoML. Use the H2O Automatic Machine Learning algorithm as a backend for Modeltime Time Series Forecasting.
R
40
star
17

modeltime.gluonts

GluonTS Deep Learning with Modeltime
R
39
star
18

portfoliodown

An R package for creating professional data science portfolios
CSS
37
star
19

gpu_accelerated_forecasting_modeltime_gluonts

GPU-Accelerated Deep Learning for Time Series using Modeltime GluonTS (Learning Lab 53). Event sponsors: Saturn Cloud, NVIDIA, & Business Science.
HTML
22
star
20

modeltime.resample

Resampling Tools for Time Series Forecasting with Modeltime
R
19
star
21

reports

A central repository of Business Science technical reports
17
star
22

workshop_2018_dsgo

DataScienceGO 2018 - Machine Learning Workshop
R
13
star
23

lab_59_cust_lifetime_py

Learning Lab 59: Customer Lifetime Value Python
Python
12
star
24

pymodeltime

Pymodeltime offers a unified framework tailored to address a broad spectrum of requirements, including time series forecasting and various machine learning models.
Python
12
star
25

awesome-generative-ai

A curated list of resources for building and deploying generative AI specifically focusing on helping you become a GenAI developer with LLMs
12
star
26

shinyauth

Dockerfile
Dockerfile
10
star
27

gammodels

The parsnip backend for GAM Models.
R
7
star
28

modeltime_h2o_workshop

R
6
star
29

webinar_introducing_pytimetk

Jupyter Notebook
5
star
30

lab_50_lightgbm

Learning Lab 50: Hierarchical Forecasting
R
5
star
31

free_ai_training

Free training to get you started learning AI for data science today!
Jupyter Notebook
5
star
32

workshop_timetk_data_viz

R
3
star
33

bsu-dev

Code for development of Business Science University courses.
3
star
34

lab_63_nested_modeltime

R
1
star
35

courseinfo

Course information, curriculum, and brochures
1
star