{"id":17172418,"url":"https://github.com/earowang/hts","last_synced_at":"2025-04-05T16:11:00.579Z","repository":{"id":12020755,"uuid":"14604078","full_name":"earowang/hts","owner":"earowang","description":"Hierarchical and Grouped Time Series","archived":false,"fork":false,"pushed_at":"2024-12-24T23:52:30.000Z","size":8478,"stargazers_count":110,"open_issues_count":18,"forks_count":37,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-29T15:11:15.516Z","etag":null,"topics":["cran","forecasts","hts","r"],"latest_commit_sha":null,"homepage":"http://pkg.earo.me/hts","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/earowang.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-11-22T00:07:17.000Z","updated_at":"2025-03-14T02:00:14.000Z","dependencies_parsed_at":"2024-12-22T15:10:54.067Z","dependency_job_id":"4629df17-89af-4a28-bef0-6af7d11fbbfa","html_url":"https://github.com/earowang/hts","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earowang%2Fhts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earowang%2Fhts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earowang%2Fhts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earowang%2Fhts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/earowang","download_url":"https://codeload.github.com/earowang/hts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361695,"owners_count":20926643,"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":["cran","forecasts","hts","r"],"created_at":"2024-10-14T23:36:56.186Z","updated_at":"2025-04-05T16:11:00.558Z","avatar_url":"https://github.com/earowang.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput:\n  github_document:\n    html_preview: false\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(collapse = TRUE, comment = \"#\u003e\", fig.path = \"man/figures/\")\n```\n\n# hts \u003cimg src=\"man/figures/logo.png\" align=\"right\" /\u003e \n\n[![R build status](https://github.com/earowang/hts/workflows/R-CMD-check/badge.svg)](https://github.com/earowang/hts/actions?workflow=R-CMD-check)\n[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/hts)](https://cran.r-project.org/package=hts)\n[![Downloads](http://cranlogs.r-pkg.org/badges/hts)](https://cran.r-project.org/package=hts)\n[![Lifecycle: retired](https://img.shields.io/badge/lifecycle-retired-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html)\n\n**hts** is retired, with minimum maintenance to keep it on CRAN. We recommend using the [fable](http://fable.tidyverts.org) package instead.\n\nThe R package *hts* presents functions to create, plot and forecast hierarchical and grouped time series. \n\n## Installation\nYou can install the **stable** version on\n[R CRAN](https://cran.r-project.org/package=hts).\n\n```r\ninstall.packages('hts', dependencies = TRUE)\n```\n\nYou can also install the **development** version from\n[Github](https://github.com/earowang/hts)\n\n```r\n# install.packages(\"devtools\")\ndevtools::install_github(\"earowang/hts\")\n```\n\n## Usage\n\n### Example 1: hierarchical time series\n\n```{r hts-eg1, echo = TRUE}\nlibrary(hts)\n\n# hts example 1\nprint(htseg1)\nsummary(htseg1)\naggts1 \u003c- aggts(htseg1)\naggts2 \u003c- aggts(htseg1, levels = 1)\naggts3 \u003c- aggts(htseg1, levels = c(0, 2))\nplot(htseg1, levels = 1)\nsmatrix(htseg1)  # Return the dense mode\n\n# Forecasts\nfcasts1.bu \u003c- forecast(\n  htseg1, h = 4, method = \"bu\", fmethod = \"ets\", parallel = TRUE\n)\naggts4 \u003c- aggts(fcasts1.bu)\nsummary(fcasts1.bu)\nfcasts1.td \u003c- forecast(\n  htseg1, h = 4, method = \"tdfp\", fmethod = \"arima\", keep.fitted = TRUE\n)\nsummary(fcasts1.td)  # When keep.fitted = TRUE, return in-sample accuracy\nfcasts1.comb \u003c- forecast(\n  htseg1, h = 4, method = \"comb\", fmethod = \"ets\", keep.fitted = TRUE\n)\naggts4 \u003c- aggts(fcasts1.comb)\nplot(fcasts1.comb, levels = 2)\nplot(fcasts1.comb, include = 5, levels = c(1, 2))\n```\n\n### Example 2: hierarchical time series\n\n```{r hts-eg2, echo = TRUE}\n# hts example 2\ndata \u003c- window(htseg2, start = 1992, end = 2002)\ntest \u003c- window(htseg2, start = 2003)\nfcasts2.mo \u003c- forecast(\n  data, h = 5, method = \"mo\", fmethod = \"ets\", level = 1,\n  keep.fitted = TRUE, keep.resid = TRUE\n)\naccuracy.gts(fcasts2.mo, test)\naccuracy.gts(fcasts2.mo, test, levels = 1)\nfcasts2.td \u003c- forecast(\n  data, h = 5, method = \"tdgsa\", fmethod = \"ets\", \n  keep.fitted = TRUE, keep.resid = TRUE\n)\nplot(fcasts2.td, include = 5)\nplot(fcasts2.td, include = 5, levels = c(0, 2))\n```\n\n### Example 3: grouped time series\n\n```{r gts-eg, echo = TRUE}\n# gts example\nplot(infantgts, levels = 1)\n\nfcasts3.comb \u003c- forecast(infantgts, h = 4, method = \"comb\", fmethod = \"ets\")\nagg_gts1 \u003c- aggts(fcasts3.comb, levels = 1)\nagg_gts2 \u003c- aggts(fcasts3.comb, levels = 1, forecasts = FALSE)\nplot(fcasts3.comb)\nplot(fcasts3.comb, include = 5, levels = c(1, 2))\n\nfcasts3.combsd \u003c- forecast(\n  infantgts, h = 4, method = \"comb\", fmethod = \"ets\",\n  weights = \"sd\", keep.fitted = TRUE\n)\n\nfcasts3.combn \u003c- forecast(\n  infantgts, h = 4, method = \"comb\", fmethod = \"ets\",\n  weights = \"nseries\", keep.resid = TRUE\n)\n```\n\n## License\n\nThis package is free and open source software, licensed under GPL (\u003e= 2).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearowang%2Fhts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearowang%2Fhts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearowang%2Fhts/lists"}