Skip to contents

Sometimes we want to see the training and testing data in a plot. This is a simple wrapper around a couple of functions from the timetk package.

Usage

ts_splits_plot(.splits_obj, .date_col, .value_col)

Arguments

.splits_obj

The predefined splits object.

.date_col

The date column for the time series.

.value_col

The value column of the time series.

Value

A time series cv plan plot

Details

You should already have a splits object defined. This function takes in three parameters, the splits object, a date column and the value column.

Author

Steven P. Sanderson II, MPH

Examples

suppressPackageStartupMessages(library(modeltime))
suppressPackageStartupMessages(library(timetk))
suppressPackageStartupMessages(library(dplyr))

data <- ts_to_tbl(AirPassengers) %>%
  select(-index)

splits <- time_series_split(
    data
    , date_col
    , assess = 12
    , skip = 3
    , cumulative = TRUE
)

ts_splits_plot(
    .splits_obj = splits,
    .date_col   = date_col,
    .value_col  = value
)