ts_splits_plot: Time Series Splits Plot

View source: R/ts-splits-plot.R

ts_splits_plotR Documentation

Time Series Splits Plot

Description

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.

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.

Value

A time series cv plan plot

Author(s)

Steven P. Sanderson II, MPH

See Also

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
)


spsanderson/healthyR.ts documentation built on Oct. 18, 2024, 5:51 p.m.