Functions for Time Series Analysis and Forecasting

Provides a set of tools for descriptive and predictive analysis of time series data. That includes functions for interactive visualization of time series objects and as well utility functions for automation time series forecasting.

The TSstudio package provides a set of functions for time series analysis. That includes interactive data visualization tools based on the plotly package engine, supporting multiple time series objects such as ts, xts, and zoo. In addition, the package provides a set of utility functions for preprocessing time series data, and as well backtesting applications for forecasting models from the forecast, forecastHybrid and bsts packages.


Install the stable version from CRAN:


or install the development version from Github:



# Ploting time series object

# Seasonal plot
ts_seasonal(USgas, type = "all")

# Lags plot
ts_lags(USgas, lags = 1:12)

# Seasonal lags plot
ts_lags(USgas, lags = c(12, 24, 36, 48))

# Heatmap plot

# Forecasting applications
# Setting training and testing partitions
USgas_s <- ts_split(ts.obj = USgas, sample.out = 12)
train <- USgas_s$train
test <- USgas_s$test
# Forecasting with auto.arima
md <- auto.arima(train)
fc <- forecast(md, h = 12)
# Plotting actual vs. fitted and forecasted
test_forecast(actual = USgas, forecast.obj = fc, test = test)

# Plotting the forecast 

# Forecasting with backtesting 
USgas_backtesting <- ts_backtesting(USgas, 
                                    models = "abehntw", 
                                    periods = 6, 
                                    error = "RMSE", 
                                    window_size = 12, 
                                    h = 12)


Version 0.1.4 is now available on CRAN

New functions

  • forecast_sim - creating different forecast paths for forecast objects (when applicable), by utilizing the underline model distribution with the simulate function
  • ts_grid - tuning time series models with grid search approach using backtesting method. Currently, support only the Holt-Winters model
  • plot_grid - plotting the output of the ts_grid function

Fix errors

  • ts_plot, test_forecast - avoid default setting of the plot_ly function, and set explicitly the plot setting (e.g., color, line mode, etc.). This allows using the function with the plotly subplot function
  • ts_seasonal - define the order of the frequency units of the box plot option plot_forecast - fixing a gap between the forecast values and the time (x-axis) values

Version 0.1.3 is now available on CRAN

  • ts_to_prophet function for converting ts objects ("ts", "zoo" and "xts" class) to prophet object
  • ccf_plot function for plotting corss correlation lags between two time series
  • Fixed error in the ts_backtesting function - supprting xreg option

Version 0.1.2 is now available on CRAN

New functions:

  • ts_backtesting - a horce race of multiple forecasting models with backtestin
  • ts_quantile - time series quantile plot for time series data
  • ts_seasonal - supports multiple inputs and new color palattes

Version 0.1.1 is now available on CRAN

What's new:

  • New options for the seasonality plot
  • Heatmap and surface plots
  • Polar plot
  • Converting function from xts and zoo to ts class
  • Spliting function for ts object for training and testing partitions

Updates for the development version ( on Github

  • Time series lags plot - ts_lags() function
  • Function ts_split() to split 'ts' object into training and testing partitions
  • Functions for converting xts and zoo objects for ts object:
    • xts_to_ts(), and
    • zoo_to_ts()
  • Two types for the seasonal_ly() plot:
    • "normal" - seasonal variation by year, or
    • "cycle" - seasonal variation by the cycle units over time (months or quarters)
    • "polar" - polar plot for seasonality
    • "box" - box-plot by cycle units
  • Decompose plot with the decompose_ly() function
  • Data set - US monthly total vehicle sales: 1976 - 2017 (USVSales), 'ts' object
  • Data set - US monthly civilian unemployment rate: 1948 - 2017 (USUnRate), 'ts' object
  • Data set - US monthly natural gas consumption: 2000 - 2017 (USgas), 'ts' object
  • Data set - University of Michigan Consumer Survey, Index of Consumer Sentiment: 1980 - 2017 (Michigan_CS), 'xts' object
  • Data set - Monthly crude Oil Prices: Brent - Europe: 1987 - 2017 (EURO_Brent), 'zoo' object

Version 0.1.0 is now available on CRAN

  • Function for plotting univariate and multivariate time series data
  • Evaluation plot for the testing set (hold-out data)
  • Interactive seasonality plot
  • Functions for interactive plot for the ACF and PACF

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.1.6 by Rami Krispin, 2 years ago

Report a bug at

Browse source code at

Authors: Rami Krispin [aut, cre]

Documentation:   PDF Manual  

Task views: Time Series Analysis

MIT + file LICENSE license

Imports data.table, dplyr, forecast, forecastHybrid, future, future.apply, lubridate, magrittr, plotly, purrr, RColorBrewer, reshape2, scales, tidyr, tsibble, viridis, xts, zoo

Suggests devtools, DT, knitr, quantmod, rmarkdown, UKgrid

Suggested by UKgrid.

See at CRAN