{"id":14066836,"url":"https://github.com/RamiKrispin/TSstudio","last_synced_at":"2025-07-29T23:32:22.868Z","repository":{"id":41453124,"uuid":"114064294","full_name":"RamiKrispin/TSstudio","owner":"RamiKrispin","description":"Tools for time series analysis and forecasting","archived":false,"fork":false,"pushed_at":"2024-01-22T17:30:33.000Z","size":42987,"stargazers_count":425,"open_issues_count":18,"forks_count":65,"subscribers_count":23,"default_branch":"main","last_synced_at":"2025-07-19T11:45:06.139Z","etag":null,"topics":["forecasting","r","rstats","time-series","timeseries","tsstudio","visualization"],"latest_commit_sha":null,"homepage":"https://ramikrispin.github.io/TSstudio/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RamiKrispin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-12-13T02:37:43.000Z","updated_at":"2025-07-04T15:16:04.000Z","dependencies_parsed_at":"2024-01-29T17:27:09.212Z","dependency_job_id":null,"html_url":"https://github.com/RamiKrispin/TSstudio","commit_stats":{"total_commits":966,"total_committers":4,"mean_commits":241.5,"dds":0.008281573498964856,"last_synced_commit":"3a24a98a21b917bf0db871a9750480c282dbb1c3"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/RamiKrispin/TSstudio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamiKrispin%2FTSstudio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamiKrispin%2FTSstudio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamiKrispin%2FTSstudio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamiKrispin%2FTSstudio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RamiKrispin","download_url":"https://codeload.github.com/RamiKrispin/TSstudio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RamiKrispin%2FTSstudio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267780047,"owners_count":24143201,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["forecasting","r","rstats","time-series","timeseries","tsstudio","visualization"],"created_at":"2024-08-13T07:05:17.194Z","updated_at":"2025-07-29T23:32:17.856Z","avatar_url":"https://github.com/RamiKrispin.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"# TSstudio \u003ca href='https://ramikrispin.github.io/TSstudio/'\u003e\u003cimg src='man/figures/TSstudio logo.png' align=\"right\"  /\u003e\u003c/a\u003e\n\n\n\n\u003c!-- badges: start --\u003e\n\n[![CRAN\\_Status\\_Badge](https://www.r-pkg.org/badges/version/TSstudio)](https://cran.r-project.org/package=TSstudio)\n[![Total Downloads](https://cranlogs.r-pkg.org/badges/grand-total/TSstudio)](https://cran.r-project.org/package=TSstudio)\n[![Downloads](http://cranlogs.r-pkg.org/badges/TSstudio)](https://cran.r-project.org/package=TSstudio)\n[![Lifecycle:Retired](https://img.shields.io/badge/Lifecycle-Retired-d45500)](https://cran.r-project.org/package=TSstudio)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/license/mit/)\n\n\u003c!-- badges: end --\u003e\n\nThe [TSstudio](https://ramikrispin.github.io/TSstudio/) package provides a set of tools descriptive and predictive analysis of time series data. That includes utility functions for preprocessing time series data,  interactive visualization functions based on the [plotly](https://CRAN.R-project.org/package=plotly) package engine, and set of tools for training and evaluating time series forecasting models from the [forecast](https://CRAN.R-project.org/package=forecast), [forecastHybrid](https://CRAN.R-project.org/package=forecastHybrid), and [bsts](https://CRAN.R-project.org/package=bsts) packages.\n\nMore information available on the package [vignettes](https://ramikrispin.github.io/TSstudio/articles/).\n\n\nInstallation\n------------\n\nInstall the stable version from [CRAN](https://CRAN.R-project.org/package=TSstudio):\n\n``` r\ninstall.packages(\"TSstudio\")\n```\n\nor install the development version from [Github](https://github.com/RamiKrispin/TSstudio):\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"RamiKrispin/TSstudio\")\n```\n\n\nUsage\n-----\n\n### Plotting time series data\n\n``` r\nlibrary(TSstudio)\ndata(USgas)\n\n# Ploting time series object\nts_plot(USgas, \n        title = \"US Monthly Natural Gas Consumption\",\n        Ytitle = \"Billion Cubic Feet\")\n```\n\u003cimg src=\"man/figures/USgas_plot.png\" width=\"100%\" /\u003e\n\n### Seasonality analysis\n``` r\n# Seasonal plot\nts_seasonal(USgas, type = \"all\")\n```\n\u003cimg src=\"man/figures/USgas_seasonal.png\" width=\"100%\" /\u003e\n\n``` r\n\n# Heatmap plot\n\nts_heatmap(USgas)\n```\n\u003cimg src=\"man/figures/USgas_heatmap.png\" width=\"100%\" /\u003e\n\n\n### Correlation analysis\n\n``` r\n# ACF and PACF plots\nts_cor(USgas, lag.max = 60)\n```\n\u003cimg src=\"man/figures/USgas_acf.png\" width=\"100%\" /\u003e\n\n``` r\n# Lags plot\nts_lags(USgas, lags = 1:12)\n```\n\n\u003cimg src=\"man/figures/USgas_lags.png\" width=\"100%\" /\u003e\n\n``` r\n# Seasonal lags plot\nts_lags(USgas, lags = c(12, 24, 36, 48))\n```\n\u003cimg src=\"man/figures/USgas_lags2.png\" width=\"100%\" /\u003e\n\n### Training forecasting models\n\n``` r\n# Forecasting applications\n# Setting training and testing partitions\nUSgas_s \u003c- ts_split(ts.obj = USgas, sample.out = 12)\ntrain \u003c- USgas_s$train\ntest \u003c- USgas_s$test\n\n# Forecasting with auto.arima\nlibrary(forecast)\nmd \u003c- auto.arima(train)\nfc \u003c- forecast(md, h = 12)\n\n# Plotting actual vs. fitted and forecasted\ntest_forecast(actual = USgas, forecast.obj = fc, test = test)\n```\n\u003cimg src=\"man/figures/USgas_test_f.png\" width=\"100%\" /\u003e\n\n``` r\n# Plotting the forecast \nplot_forecast(fc)\n```\n\u003cimg src=\"man/figures/USgas_forecast.png\" width=\"100%\" /\u003e\n\n``` r\n# Run horse race between multiple models\nmethods \u003c- list(ets1 = list(method = \"ets\",\n                            method_arg = list(opt.crit = \"lik\"),\n                            notes = \"ETS model with opt.crit = lik\"),\n                ets2 = list(method = \"ets\",\n                            method_arg = list(opt.crit = \"amse\"),\n                            notes = \"ETS model with opt.crit = amse\"),\n                arima1 = list(method = \"arima\",\n                              method_arg = list(order = c(2,1,0)),\n                              notes = \"ARIMA(2,1,0)\"),\n                arima2 = list(method = \"arima\",\n                              method_arg = list(order = c(2,1,2),\n                                                seasonal = list(order = c(1,1,1))),\n                              notes = \"SARIMA(2,1,2)(1,1,1)\"),\n                hw = list(method = \"HoltWinters\",\n                          method_arg = NULL,\n                          notes = \"HoltWinters Model\"),\n                tslm = list(method = \"tslm\",\n                            method_arg = list(formula = input ~ trend + season),\n                            notes = \"tslm model with trend and seasonal components\"))\n# Training the models with backtesting\nmd \u003c- train_model(input = USgas,\n                  methods = methods,\n                  train_method = list(partitions = 6, \n                                      sample.out = 12, \n                                      space = 3),\n                  horizon = 12,\n                  error = \"MAPE\")\n# A tibble: 6 x 7\n  model_id model       notes                                         avg_mape avg_rmse `avg_coverage_80%` `avg_coverage_95%`\n  \u003cchr\u003e    \u003cchr\u003e       \u003cchr\u003e                                            \u003cdbl\u003e    \u003cdbl\u003e              \u003cdbl\u003e              \u003cdbl\u003e\n1 arima2   arima       SARIMA(2,1,2)(1,1,1)                            0.0557     167.              0.583              0.806\n2 hw       HoltWinters HoltWinters Model                               0.0563     163.              0.736              0.889\n3 ets1     ets         ETS model with opt.crit = lik                   0.0611     172.              0.681              0.903\n4 ets2     ets         ETS model with opt.crit = amse                  0.0666     186.              0.458              0.833\n5 tslm     tslm        tslm model with trend and seasonal components   0.0767     220.              0.417              0.667\n6 arima1   arima       ARIMA(2,1,0)                                    0.188      598.              0.875              0.958\n\n```\n\n\n``` r\n# Plot the performance of the different models on the testing partitions\nplot_model(md)\n```\n\n\u003cimg src=\"man/figures/plot_model.gif\" width=\"100%\" /\u003e\n\n\n``` r\n# Holt-Winters tunning parameters with grid search\nhw_grid \u003c- ts_grid(USgas, \n                   model = \"HoltWinters\",\n                   periods = 6,\n                   window_space = 6,\n                   window_test = 12,\n                   hyper_params = list(alpha = seq(0,1,0.1),\n                                       beta = seq(0,1,0.1),\n                                       gamma = seq(0,1,0.1)))\n                                       \nplot_grid(hw_grid, type = \"3D\")\n```\n\n\u003cimg src=\"man/figures/hw_grid.png\" width=\"100%\" /\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRamiKrispin%2FTSstudio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRamiKrispin%2FTSstudio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRamiKrispin%2FTSstudio/lists"}