autoplot.tulip_paths: Autoplot method for 'tulip_paths' objects

View source: R/autoplot.R

autoplot.tulip_pathsR Documentation

Autoplot method for tulip_paths objects

Description

Use ggplot2 to visualize the marginal forecast quantiles, or a few sample paths of a tulip forecast object of class tulip_paths

Usage

autoplot.tulip_paths(
  object,
  ...,
  method = c("forecast", "paths")[1],
  date = NULL,
  date_future = NULL,
  show_params = TRUE,
  n = 5,
  alpha = 0.75
)

Arguments

object

An object of class tulip_paths as returned by ⁠[predict.tulip()]⁠

...

ignored

method

One of forecast for visualization of quantiles of the marginal forecast distribution (i.e., the usual fanchart), or paths to visualize a few sample paths from the joint forecast distribution

date

Optional additional vector with dates in format that can be cast to YYYY-MM-DD with same length as object$y, used to create x-axis

date_future

Optional additional vector with dates in format that can be cast to YYYY-MM-DD with same length as object$y, used to create x-axis for forecast path

show_params

Logical; if TRUE (default) then fitted params will be displayed using ggplot2::facet_wrap(); used when method is "forecast"

n

Number of paths to add to plot, a small number is recommended to be able to see the individual paths; scalar integer between 1 and 10; used when method is "paths"

alpha

The transparency parameter used when adding the paths to the plot, provided to ggplot2::geom_point() and ggplot2::geom_line(); used when method is "paths"

Details

Note: This function will use base::sample() to randomly select paths that are added to the plot. Set a seed if you require reproducibility.


timradtke/heuristika documentation built on April 24, 2023, 1:55 a.m.