Use ggplot2
to visualize the marginal forecast quantiles, or a few sample
paths of a threedx
forecast object of class threedx_paths
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), orpaths
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 asobject$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 asobject$y
, used to create x-axis for forecast path- show_params
Logical; if
TRUE
(default) then fitted params will be displayed usingggplot2::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()
andggplot2::geom_line()
; used whenmethod
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.