TSstudio

Tools for time series analysis and forecasting

https://github.com/ramikrispin/tsstudio

Science Score: 10.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 4 committers (25.0%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.8%) to scientific vocabulary

Keywords

forecasting r rstats time-series timeseries tsstudio visualization
Last synced: 6 months ago · JSON representation

Repository

Tools for time series analysis and forecasting

Basic Info
Statistics
  • Stars: 427
  • Watchers: 23
  • Forks: 65
  • Open Issues: 18
  • Releases: 7
Topics
forecasting r rstats time-series timeseries tsstudio visualization
Created about 8 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.md

TSstudio

CRAN\_Status\_Badge Total Downloads Downloads Lifecycle:Retired License: MIT

The 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 package engine, and set of tools for training and evaluating time series forecasting models from the forecast, forecastHybrid, and bsts packages.

More information available on the package vignettes.

Installation

Install the stable version from CRAN:

r install.packages("TSstudio")

or install the development version from Github:

``` r

install.packages("devtools")

devtools::install_github("RamiKrispin/TSstudio") ```

Usage

Plotting time series data

``` r library(TSstudio) data(USgas)

Ploting time series object

tsplot(USgas, title = "US Monthly Natural Gas Consumption", Ytitle = "Billion Cubic Feet") ``` <img src="man/figures/USgasplot.png" width="100%" />

Seasonality analysis

``` r

Seasonal plot

tsseasonal(USgas, type = "all") ``` <img src="man/figures/USgasseasonal.png" width="100%" />

``` r

Heatmap plot

tsheatmap(USgas) ``` <img src="man/figures/USgasheatmap.png" width="100%" />

Correlation analysis

``` r

ACF and PACF plots

tscor(USgas, lag.max = 60) ``` <img src="man/figures/USgasacf.png" width="100%" />

``` r

Lags plot

ts_lags(USgas, lags = 1:12) ```

``` r

Seasonal lags plot

tslags(USgas, lags = c(12, 24, 36, 48)) ``` <img src="man/figures/USgaslags2.png" width="100%" />

Training forecasting models

``` r

Forecasting applications

Setting training and testing partitions

USgass <- tssplit(ts.obj = USgas, sample.out = 12) train <- USgass$train test <- USgass$test

Forecasting with auto.arima

library(forecast) md <- auto.arima(train) fc <- forecast(md, h = 12)

Plotting actual vs. fitted and forecasted

testforecast(actual = USgas, forecast.obj = fc, test = test) ``` <img src="man/figures/USgastest_f.png" width="100%" />

``` r

Plotting the forecast

plotforecast(fc) ``` <img src="man/figures/USgasforecast.png" width="100%" />

``` r

Run horse race between multiple models

methods <- list(ets1 = list(method = "ets", methodarg = list(opt.crit = "lik"), notes = "ETS model with opt.crit = lik"), ets2 = list(method = "ets", methodarg = list(opt.crit = "amse"), notes = "ETS model with opt.crit = amse"), arima1 = list(method = "arima", methodarg = list(order = c(2,1,0)), notes = "ARIMA(2,1,0)"), arima2 = list(method = "arima", methodarg = list(order = c(2,1,2), seasonal = list(order = c(1,1,1))), notes = "SARIMA(2,1,2)(1,1,1)"), hw = list(method = "HoltWinters", methodarg = NULL, notes = "HoltWinters Model"), tslm = list(method = "tslm", methodarg = list(formula = input ~ trend + season), notes = "tslm model with trend and seasonal components"))

Training the models with backtesting

md <- trainmodel(input = USgas, methods = methods, trainmethod = list(partitions = 6, sample.out = 12, space = 3), horizon = 12, error = "MAPE")

A tibble: 6 x 7

modelid model notes avgmape avgrmse `avgcoverage80%avgcoverage_95%` 1 arima2 arima SARIMA(2,1,2)(1,1,1) 0.0557 167. 0.583 0.806 2 hw HoltWinters HoltWinters Model 0.0563 163. 0.736 0.889 3 ets1 ets ETS model with opt.crit = lik 0.0611 172. 0.681 0.903 4 ets2 ets ETS model with opt.crit = amse 0.0666 186. 0.458 0.833 5 tslm tslm tslm model with trend and seasonal components 0.0767 220. 0.417 0.667 6 arima1 arima ARIMA(2,1,0) 0.188 598. 0.875 0.958

```

``` r

Plot the performance of the different models on the testing partitions

plot_model(md) ```

``` r

Holt-Winters tunning parameters with grid search

hwgrid <- tsgrid(USgas, model = "HoltWinters", periods = 6, windowspace = 6, windowtest = 12, hyper_params = list(alpha = seq(0,1,0.1), beta = seq(0,1,0.1), gamma = seq(0,1,0.1)))

plotgrid(hwgrid, type = "3D") ```

Owner

  • Name: Rami Krispin
  • Login: RamiKrispin
  • Kind: user
  • Location: Cupertino, California, US

Data science and engineering manager | Author, open-source contributor 👨🏻‍💻 | Time-series analysis and forecasting ❤️ | Opinions are my own 😎

GitHub Events

Total
  • Watch event: 7
  • Fork event: 2
Last Year
  • Watch event: 7
  • Fork event: 2

Committers

Last synced: about 2 years ago

All Time
  • Total Commits: 966
  • Total Committers: 4
  • Avg Commits per committer: 241.5
  • Development Distribution Score (DDS): 0.008
Past Year
  • Commits: 10
  • Committers: 2
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
RamiKrispin r****p@u****u 958
rkrispin r****n@a****m 6
Danton Noriega d****n@a****m 1
earowang e****g@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 53
  • Total pull requests: 18
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 2 months
  • Total issue authors: 27
  • Total pull request authors: 4
  • Average comments per issue: 1.58
  • Average comments per pull request: 0.11
  • Merged pull requests: 17
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • RamiKrispin (21)
  • VitoFanelli (4)
  • verajosemanuel (3)
  • rsangole (2)
  • ercbk (1)
  • aki2023-1 (1)
  • kaes98 (1)
  • quangvu16 (1)
  • bergarog (1)
  • datalee (1)
  • Francesco-Ghizzo (1)
  • mbanco (1)
  • yingpublic (1)
  • AnningerChris (1)
  • zeileis (1)
Pull Request Authors
  • RamiKrispin (15)
  • olivroy (2)
  • earowang (1)
  • dantonnoriega (1)
Top Labels
Issue Labels
enhancement (18) bug (10) New Feature (3)
Pull Request Labels

Packages

  • Total packages: 4
  • Total downloads:
    • cran 2,698 last-month
  • Total docker downloads: 43,390
  • Total dependent packages: 1
    (may contain duplicates)
  • Total dependent repositories: 1
    (may contain duplicates)
  • Total versions: 11
  • Total maintainers: 1
proxy.golang.org: github.com/RamiKrispin/TSstudio
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
proxy.golang.org: github.com/ramikrispin/tsstudio
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.5%
Average: 5.6%
Dependent repos count: 5.8%
Last synced: 6 months ago
cran.r-project.org: TSstudio

Functions for Time Series Analysis and Forecasting

  • Versions: 8
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 2,698 Last month
  • Docker Downloads: 43,390
Rankings
Docker downloads count: 0.6%
Stargazers count: 0.9%
Forks count: 1.1%
Downloads: 6.4%
Average: 8.5%
Dependent packages count: 18.1%
Dependent repos count: 23.9%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: r-tsstudio
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 18.5%
Forks count: 20.5%
Average: 31.0%
Dependent repos count: 34.0%
Dependent packages count: 51.2%
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.0.2 depends
  • RColorBrewer >= 1.1 imports
  • data.table >= 1.11.2 imports
  • dplyr >= 0.7.5 imports
  • forecast >= 8.2 imports
  • forecastHybrid >= 2.0.10 imports
  • future >= 1.10.0 imports
  • future.apply >= 1.0.1 imports
  • lubridate >= 1.6.0 imports
  • magrittr >= 1.5 imports
  • plotly >= 4.7.1 imports
  • purrr >= 0.2.5 imports
  • reshape2 >= 1.4.2 imports
  • scales >= 1.0.0 imports
  • tidyr >= 0.8.1 imports
  • tsibble >= 0.8.2 imports
  • viridis >= 0.5.1 imports
  • xts >= 0.12 imports
  • zoo >= 1.8 imports
  • DT * suggests
  • UKgrid * suggests
  • devtools * suggests
  • knitr * suggests
  • quantmod * suggests
  • rmarkdown * suggests