Skip to contents

Plotting Time Series

Detect relationships through visualizations

Time Series Plotting

plot_time_series()
Interactive Plotting for One or More Time Series
plot_time_series_boxplot()
Interactive Time Series Box Plots
plot_time_series_regression()
Visualize a Time Series Linear Regression Formula

Correlation, Seasonalilty, & Anomaly Plotting

plot_acf_diagnostics()
Visualize the ACF, PACF, and CCFs for One or More Time Series
plot_anomaly_diagnostics()
Visualize Anomalies for One or More Time Series
plot_seasonal_diagnostics()
Visualize Multiple Seasonality Features for One or More Time Series
plot_stl_diagnostics()
Visualize STL Decomposition Features for One or More Time Series

Time Series Data Wrangling Operations

Extension for dplyr for time-series data manipulations

Data Frame Operations

summarise_by_time() summarize_by_time()
Summarise (for Time Series Data)
mutate_by_time()
Mutate (for Time Series Data)
pad_by_time()
Insert time series rows with regularly spaced timestamps
filter_by_time()
Filter (for Time-Series Data)
filter_period()
Apply filtering expressions inside periods (windows)
slice_period()
Apply slice inside periods (windows)
condense_period()
Convert the Period to a Lower Periodicity (e.g. Go from Daily to Monthly)
future_frame()
Make future time series from existing

Function Operations

slidify()
Create a rolling (sliding) version of any function

Vector Operations

between_time()
Between (For Time Series): Range detection for date or date-time sequences
add_time() subtract_time() `%+time%` `%-time%`
Add / Subtract (For Time Series)

Time Series Features

Tidy integration with tsfeatures

tk_tsfeatures()
Time series feature matrix (Tidy)

Augment Operations (Quickly Add Many Features)

Add multiple columns to the original data. Respects dplyr groups.

tk_augment_timeseries_signature()
Add many time series features to the data
tk_augment_holiday_signature()
Add many holiday features to the data
tk_augment_slidify()
Add many rolling window calculations to the data
tk_augment_differences()
Add many differenced columns to the data
tk_augment_lags() tk_augment_leads()
Add many lags to the data
tk_augment_fourier()
Add many fourier series to the data

Vectorized Transformations

Use with mutate to apply vectorized transformations to time series data

box_cox_vec() box_cox_inv_vec() auto_lambda()
Box Cox Transformation
diff_vec() diff_inv_vec()
Differencing Transformation
lag_vec() lead_vec()
Lag Transformation
standardize_vec() standardize_inv_vec()
Standardize to Mean 0, Standard Deviation 1 (Center & Scale)
normalize_vec() normalize_inv_vec()
Normalize to Range (0, 1)
fourier_vec()
Fourier Series
log_interval_vec() log_interval_inv_vec()
Log-Interval Transformation for Constrained Interval Forecasting
slidify_vec()
Rolling Window Transformation
smooth_vec()
Smoothing Transformation using Loess
ts_clean_vec()
Replace Outliers & Missing Values in a Time Series
ts_impute_vec()
Missing Value Imputation for Time Series

Feature Engineering Operations (Recipe Steps)

Preprocessing & feature engineering operations for use with recipes and the tidymodels ecosystem

Engineered Features

step_timeseries_signature() tidy(<step_timeseries_signature>)
Time Series Feature (Signature) Generator
step_holiday_signature() tidy(<step_holiday_signature>)
Holiday Feature (Signature) Generator
step_fourier() tidy(<step_fourier>)
Fourier Features for Modeling Seasonality

Lags & Diffs

See recipes::step_lag() for lagged features.

step_diff() tidy(<step_diff>)
Create a differenced predictor

Smoothing & Rolling

step_smooth() tidy(<step_smooth>)
Smoothing Transformation using Loess
step_slidify() tidy(<step_slidify>)
Slidify Rolling Window Transformation
step_slidify_augment() tidy(<step_slidify_augment>)
Slidify Rolling Window Transformation (Augmented Version)

Variance Reduction

See recipes::step_log() for log transformation.

step_box_cox() tidy(<step_box_cox>)
Box-Cox Transformation using Forecast Methods
step_log_interval() tidy(<step_log_interval>)
Log Interval Transformation for Constrained Interval Forecasting

Add Rows to a Time series

step_ts_pad() tidy(<step_ts_pad>)
Pad: Add rows to fill gaps and go from low to high frequency

Imputation & Outlier Cleaning

See recipes::step_rollimpute() for rolling imputation.

step_ts_impute() tidy(<step_ts_impute>)
Missing Data Imputation for Time Series
step_ts_clean() tidy(<step_ts_clean>)
Clean Outliers and Missing Data for Time Series

Cross Validation Operations (Rsample & Tune)

Resampling for time series cross validation using rsamples

Time Series Cross Validation (Resample Sets)

time_series_split()
Simple Training/Test Set Splitting for Time Series
time_series_cv()
Time Series Cross Validation

Cross Validation Plan Visualization (Resample Sets)

Uses the output of time_series_cv or rsample::rolling_origin

plot_time_series_cv_plan()
Visualize a Time Series Resample Plan
tk_time_series_cv_plan()
Time Series Resample Plan Data Preparation

Index Operations

Extract and check the date or date-time index.

tk_index() has_timetk_idx()
Extract an index of date or datetime from time series objects, models, forecasts

Make Operations

Make time series sequences.

tk_make_timeseries()
Intelligent date and date-time sequence creation
tk_make_future_timeseries()
Make future time series from existing
tk_make_holiday_sequence() tk_make_weekend_sequence() tk_make_weekday_sequence()
Make daily Holiday and Weekend date sequences

Get Operations

Get summaries, frequency, and signatures from the time series index.

tk_get_timeseries_signature() tk_get_timeseries_summary()
Get date features from a time-series index
tk_get_holiday_signature() tk_get_holidays_by_year()
Get holiday features from a time-series index
tk_get_frequency() tk_get_trend()
Automatic frequency and trend calculation from a time series index
tk_get_timeseries_unit_frequency()
Get the timeseries unit frequency for the primary time scales
tk_get_timeseries_variables()
Get date or datetime variables (column names)

Diagnostic Operations

These power the time series plotting functions

tk_summary_diagnostics()
Group-wise Time Series Summary
tk_anomaly_diagnostics()
Automatic group-wise Anomaly Detection by STL Decomposition
tk_acf_diagnostics()
Group-wise ACF, PACF, and CCF Data Preparation
tk_seasonal_diagnostics()
Group-wise Seasonality Data Preparation
tk_stl_diagnostics()
Group-wise STL Decomposition (Season, Trend, Remainder)

Conversion Operations

Functions for converting between common time series formats.

tk_tbl()
Coerce time-series objects to tibble.
tk_ts() tk_ts_()
Coerce time series objects and tibbles with date/date-time columns to ts.
tk_xts() tk_xts_()
Coerce time series objects and tibbles with date/date-time columns to xts.
tk_zoo() tk_zoo_()
Coerce time series objects and tibbles with date/date-time columns to xts.
tk_zooreg() tk_zooreg_()
Coerce time series objects and tibbles with date/date-time columns to ts.

Time Scale Template

The timescale template is used to automate frequency and trendcycle calculations.

Time Series Datasets

Time series from various forecasting competitions. Domains include economic, retail, and web (google analytics)

m4_hourly
Sample of 4 Hourly Time Series Datasets from the M4 Competition
m4_daily
Sample of 4 Daily Time Series Datasets from the M4 Competition
m4_weekly
Sample of 4 Weekly Time Series Datasets from the M4 Competition
m4_monthly
Sample of 4 Monthly Time Series Datasets from the M4 Competition
m4_quarterly
Sample of 4 Quarterly Time Series Datasets from the M4 Competition
m4_yearly
Sample of 4 Yearly Time Series Datasets from the M4 Competition
walmart_sales_weekly
Sample Time Series Retail Data from the Walmart Recruiting Store Sales Forecasting Competition
wikipedia_traffic_daily
Sample Daily Time Series Data from the Web Traffic Forecasting (Wikipedia) Competition
bike_sharing_daily
Daily Bike Sharing Data
taylor_30_min
Half-hourly electricity demand

Date Utilities

parse_date2() parse_datetime2()
Fast, flexible date and datetime parsing
is_date_class()
Check if an object is a date class

Package Information

timetk
timetk: Time Series Analysis in the Tidyverse