plot_time_series_cv_plan: Visualize a Time Series Resample Plan

View source: R/rsample-plot_time_series_cv_plan.R

plot_time_series_cv_planR Documentation

Visualize a Time Series Resample Plan


The plot_time_series_cv_plan() function provides a visualization for a time series resample specification (rset) of either rolling_origin or time_series_cv class.


  .smooth = FALSE,
  .title = "Time Series Cross Validation Plan"



A time series resample specification of of either rolling_origin or time_series_cv class or a data frame (tibble) that has been prepared using tk_time_series_cv_plan().


A column containing either date or date-time values


A column containing numeric values


Additional parameters passed to plot_time_series()


Logical - Whether or not to include a trendline smoother. Uses See smooth_vec() to apply a LOESS smoother.


Title for the plot


Resample Set

A resample set is an output of the timetk::time_series_cv() function or the rsample::rolling_origin() function.


Returns a static ggplot or interactive plotly object depending on whether or not .interactive is FALSE or TRUE, respectively.

See Also

  • time_series_cv() and rsample::rolling_origin() - Functions used to create time series resample specfications.

  • plot_time_series_cv_plan() - The plotting function used for visualizing the time series resample plan.



FB_tbl <- FANG %>%
    filter(symbol == "FB") %>%
    select(symbol, date, adjusted)

resample_spec <- time_series_cv(
    initial = "1 year",
    assess  = "6 weeks",
    skip    = "3 months",
    lag     = "1 month",
    cumulative  = FALSE,
    slice_limit = 6

resample_spec %>% tk_time_series_cv_plan()

resample_spec %>%
    tk_time_series_cv_plan() %>%
        date, adjusted, # date variable and value variable
        # Additional arguments passed to plot_time_series(),
        .facet_ncol = 2,
        .line_alpha = 0.5,
        .interactive = FALSE

timetk documentation built on Nov. 2, 2023, 6:18 p.m.