{"id":20365946,"url":"https://github.com/business-science/sweep","last_synced_at":"2025-04-05T00:09:39.924Z","repository":{"id":21951441,"uuid":"94035334","full_name":"business-science/sweep","owner":"business-science","description":"Extending broom for time series forecasting","archived":false,"fork":false,"pushed_at":"2024-01-04T19:41:54.000Z","size":34414,"stargazers_count":155,"open_issues_count":6,"forks_count":31,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-28T23:07:34.287Z","etag":null,"topics":["broom","forecast","forecasting-models","prediction","r-package","tidy","tidyverse","time","time-series","timeseries"],"latest_commit_sha":null,"homepage":"https://business-science.github.io/sweep/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/business-science.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-06-11T22:24:01.000Z","updated_at":"2024-08-30T07:17:04.000Z","dependencies_parsed_at":"2023-12-16T20:07:51.148Z","dependency_job_id":"df4819ab-39e4-405c-87b0-6c7c8449c0cb","html_url":"https://github.com/business-science/sweep","commit_stats":{"total_commits":107,"total_committers":6,"mean_commits":"17.833333333333332","dds":0.2149532710280374,"last_synced_commit":"940f2871641b794433f6fb5434b3fab979bfd317"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/business-science%2Fsweep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/business-science%2Fsweep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/business-science%2Fsweep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/business-science%2Fsweep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/business-science","download_url":"https://codeload.github.com/business-science/sweep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266564,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["broom","forecast","forecasting-models","prediction","r-package","tidy","tidyverse","time","time-series","timeseries"],"created_at":"2024-11-15T00:21:21.879Z","updated_at":"2025-04-05T00:09:39.902Z","avatar_url":"https://github.com/business-science.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n    message = F, \n    warning = F,\n    collapse = TRUE,\n    comment = \"#\u003e\",\n    fig.path = \"README-\"\n)\n```\n\n```{r, echo=FALSE}\nlibrary(tidyquant)\nlibrary(sweep)\n```\n\n\n# sweep \u003cimg src=\"man/figures/logo.png\" width=\"147\" height=\"170\" align=\"right\" /\u003e\n\n\n\u003e Extending `broom` to time series forecasting\n\n \u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/business-science/sweep/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/business-science/sweep/actions/workflows/R-CMD-check.yaml)\n[![codecov](https://codecov.io/gh/business-science/sweep/branch/master/graph/badge.svg)](https://app.codecov.io/gh/business-science/sweep)\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/sweep)](https://cran.r-project.org/package=sweep)\n![](http://cranlogs.r-pkg.org/badges/sweep?color=brightgreen)\n![](http://cranlogs.r-pkg.org/badges/grand-total/sweep?color=brightgreen)\n\u003c!-- badges: end --\u003e\n\nThe `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. \n\n## Benefits\n\n* __Designed for modeling and scaling forecasts using the the `tidyverse` tools in [_R for Data Science_](https://r4ds.hadley.nz/)__\n* __Extends `broom` for model analysis (ARIMA, ETS, BATS, etc)__\n* __Tidies the `forecast` objects for easy plotting and \"tidy\" data manipulation__\n* __Integrates `timetk` to enable dates and datetimes (irregular time series) in the tidied forecast output__\n\n\n## Tools\n\nThe package contains the following elements:\n\n1. __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. \n\n2. __forecast tidier__: `sw_sweep` converts a `forecast` object to a tibble that can be easily manipulated in the \"tidyverse\".\n\n\n## Making forecasts in the tidyverse\n\n`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.\n\n```{r echo=FALSE, out.width='100%'}\nknitr::include_graphics(\"man/figures/forecast.png\")\n```\n\n## Forecasting multiple time series groups at scale\n\nOften 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`.\n\n```{r echo=FALSE, out.width='100%'}\nknitr::include_graphics(\"man/figures/time_series_groups.png\")\n```\n\n## Forecasting multiple models for accuracy\n\nA common goal in forecasting is to compare different forecast models against each other. `sweep` helps in this area as well.\n\n\n```{r echo=FALSE, out.width='100%'}\nknitr::include_graphics(\"man/figures/multiple_models.png\")\n```\n\n## broom extensions for forecasting\n\nIf 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:\n\n* `sw_tidy`: Returns model coefficients (single column)\n* `sw_glance`: Returns accuracy statistics (single row) \n* `sw_augment`: Returns residuals \n* `sw_tidy_decomp`: Returns seasonal decompositions\n* `sw_sweep`: Returns tidy forecast outputs. \n\nThe compatibility chart is listed below.\n\n```{r, echo = F}\ntibble::tribble(\n    ~Object,       ~`sw_tidy()`, ~`sw_glance()`, ~`sw_augment()`, ~`sw_tidy_decomp()`, ~`sw_sweep()`,\n    \"ar\",          \"\",  \"\",  \"\", \"\",   \"\",\n    \"arima\",       \"X\", \"X\", \"X\", \"\",  \"\",\n    \"Arima\",       \"X\", \"X\", \"X\", \"\",  \"\",\n    \"ets\",         \"X\", \"X\", \"X\", \"X\", \"\",\n    \"baggedETS\",   \"\",  \"\",  \"\",  \"\",  \"\",\n    \"bats\",        \"X\", \"X\", \"X\", \"X\", \"\",\n    \"tbats\",       \"X\", \"X\", \"X\", \"X\", \"\",\n    \"nnetar\",      \"X\", \"X\", \"X\", \"\",  \"\",\n    \"stl\",         \"\",  \"\",  \"\",  \"X\", \"\",\n    \"HoltWinters\", \"X\", \"X\", \"X\", \"X\", \"\",\n    \"StructTS\",    \"X\", \"X\", \"X\", \"X\", \"\",\n    \"tslm\",        \"X\", \"X\", \"X\", \"\",  \"\",\n    \"decompose\",   \"\",  \"\",  \"\",  \"X\", \"\",\n    \"adf.test\",    \"X\", \"X\", \"\",  \"\",  \"\",\n    \"Box.test\",    \"X\", \"X\", \"\",  \"\",  \"\",\n    \"kpss.test\",   \"X\", \"X\", \"\",  \"\",  \"\",\n    \"forecast\",    \"\",  \"\",  \"\",  \"\",  \"X\"\n) %\u003e%\n    knitr::kable(caption = \"Function Compatibility\",\n                 align = c(\"l\", \"c\", \"c\", \"c\", \"c\", \"c\"))\n```\n\n\n## Installation\n\nHere's how to get started.\n\nDevelopment version with latest features:\n\n``` {r, eval = FALSE}\n# install.packages(\"remotes\")\nremotes::install_github(\"business-science/sweep\")\n```\n\n\u003c!-- CRAN approved version: --\u003e\n\n\u003c!-- ```{r, eval = FALSE} --\u003e\n\u003c!-- install.packages(\"sweep\") --\u003e\n\u003c!-- ``` --\u003e\n\n\n\n## Further Information\n\nThe `sweep` package includes several vignettes to help users get up to speed quickly:\n\n* SW00 - Introduction to `sweep`\n* SW01 - Forecasting Time Series Groups in the tidyverse\n* SW02 - Forecasting Using Multiple Models\n\n\u003c!-- See the [`tidyquant` vignettes](https://cran.r-project.org/package=tidyquant) for further details on the package. --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbusiness-science%2Fsweep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbusiness-science%2Fsweep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbusiness-science%2Fsweep/lists"}