Skip to contents

Time Series Cross-Validation

Functions and utilities for time series cross-validation

make_split()
Create train-test splits for time series cross-validation
slice_train()
Slice training data from a split frame
slice_test()
Slice test data from a split frame
split_index()
Create indices for train and test splits
make_future()
Convert forecasts to a future frame
make_tsibble()
Convert data to a tsibble

Forecast Accuracy

Functions and utilities for forecast accuracy

make_accuracy()
Estimate point forecast accuracy
make_errors()
Calculate forecast errors and percentage errors
me_vec()
Calculate the mean error
mae_vec()
Calculate the mean absolute error
mse_vec()
Calculate the mean squared error
rmse_vec()
Calculate the root mean squared error
mpe_vec()
Calculate the mean percentage error
mape_vec()
Calculate the mean absolute percentage error
smape_vec()
Calculate the symmetric mean absolute percentage error

Data Analysis

Functions and utilities for data analysis, etc.

estimate_mode()
Estimate the mode of a distribution
estimate_kurtosis()
Estimate kurtosis
estimate_skewness()
Estimate skewness
acf_vec()
Estimate autocorrelations of a numeric vector
estimate_acf()
Estimate autocorrelations by time series
pacf_vec()
Estimate partial autocorrelations of a numeric vector
estimate_pacf()
Estimate partial autocorrelations by time series
interpolate_missing()
Interpolate missing values
smooth_outlier()
Identify and replace outliers
check_data()
Check and prepare tsibble data
summarise_data()
Summarise time series data
summarise_stats()
Summarise distributional statistics by time series
summarise_split()
Summarise train-test splits

Data Visualization

Functions and utilities for data visualization

plot_bar()
Plot data as a bar chart
plot_density()
Plot a kernel density estimate
plot_histogram()
Plot data as a histogram
plot_line()
Plot data as a line chart
plot_point()
Plot data as a scatterplot
plot_qq()
Create a quantile-quantile plot
theme_tscv()
Custom ggplot2 theme for tscv
scale_color_tscv()
Create a tscv color scale
scale_fill_tscv()
Create a tscv fill scale
tscv_cols()
Extract tscv colors
tscv_pal()
Create a tscv color palette

Forecasting

DSHW

The DSHW model and its supported methods

DSHW()
Double Seasonal Holt-Winters model
forecast(<DSHW>)
Forecast a DSHW model
fitted(<DSHW>)
Extract fitted values from a DSHW model
residuals(<DSHW>)
Extract residuals from a DSHW model
model_sum(<DSHW>)
Summarize a DSHW model

SMEAN

The SMEAN model and its supported methods

SMEAN()
Seasonal mean model
forecast(<SMEAN>)
Forecast a seasonal mean model
fitted(<SMEAN>)
Extract fitted values from a seasonal mean model
residuals(<SMEAN>)
Extract residuals from a seasonal mean model
model_sum(<SMEAN>)
Summarize a seasonal mean model

SMEDIAN

The SMEDIAN model and its supported methods

SMEDIAN()
Seasonal median model
forecast(<SMEDIAN>)
Forecast a seasonal median model
fitted(<SMEDIAN>)
Extract fitted values from a seasonal median model
residuals(<SMEDIAN>)
Extract residuals from a seasonal median model
model_sum(<SMEDIAN>)
Summarize a seasonal median model

MEDIAN

The MEDIAN model and its supported methods

MEDIAN()
Median model
forecast(<MEDIAN>)
Forecast a median model
fitted(<MEDIAN>)
Extract fitted values from a median model
residuals(<MEDIAN>)
Extract residuals from a median model
model_sum(<MEDIAN>)
Summarize a median model

SNAIVE2

The SNAIVE2 model and its supported methods

SNAIVE2()
Seasonal naive model with weekday-specific lags
forecast(<SNAIVE2>)
Forecast a SNAIVE2 model
fitted(<SNAIVE2>)
Extract fitted values from a SNAIVE2 model
residuals(<SNAIVE2>)
Extract residuals from a SNAIVE2 model
model_sum(<SNAIVE2>)
Summarize a SNAIVE2 model

TBATS

The TBATS model and its supported methods

TBATS()
TBATS model
forecast(<TBATS>)
Forecast a TBATS model
fitted(<TBATS>)
Extract fitted values from a TBATS model
residuals(<TBATS>)
Extract residuals from a TBATS model
model_sum(<TBATS>)
Summarize a TBATS model

Data sets

Example data sets

elec_load
Hourly electricity load (actual values and forecasts)
elec_price
Hourly day-ahead electricity spot prices
M4_monthly_data
Monthly time series data from the M4 Competition
M4_quarterly_data
Quarterly time series data from the M4 Competition