Skip to contents

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

Usage

# S3 method for threedx_paths
autoplot(
  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 threedx_paths as returned by [predict.threedx()]

...

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()

n

Number of paths to add to plot, a small number is recommended to be able to see the individual paths; positive scalar integer; 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.