plotFan: Fan chart

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/plotFanChart.R View source: R/plotFan.R

Description

Draws a fan chart for forecasts for a specified method, time series, and origin.

Usage

1
2
plotFan(ts, fc, series, origin, method, graphLib = "dygraphs",
  piColor = "blue")

Arguments

ts

dataframe containing time series actuals formatted using the Time Series Table Schema (TSTS), use showTSTS() to display schema specification details. ts must contain timestamp_dbo column with timestamps formatted as an appropriate time-based object.

fc

dataframe containing forecasts formatted using the Forecast Table Schema (FTS), use showFTS() to display schema specification details. fc must contain timestamp_dbo column with timestamps formatted as an appropriate time-based object.

series

series_id for the time series to be shown.

origin

origin_timestamp for the origin of the forecast to be shown.

method

method_id for the method to be shown.

graphLib

choose method for disp

Details

Generates a fan chart joining a simple line chart for actuals (given in the TSTS format) with ranges for possible future values (given in the FTS format). Uses all the prediction intervals available in fc.

Current time-based objects supported are Date, POSIXct, chron, yearmon, yearqtr, and timeDate.

Value

A dygraph object with the fan chart.

Author(s)

Cuong Sai, Andrey Davydenko, and Maxim Shcherbakov.

See Also

plotFixedHorizon, plotFixedOrigin

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# obtain data
ts <- example1_ts
fc <- example1_fc

# create the "timestamp_dbo" column
library(zoo)
ts$timestamp_dbo <- as.yearmon(ts$timestamp, format = '%Y')
fc$timestamp_dbo <- as.yearmon(fc$timestamp, '%Y')

# plot the fan chart for some given origin, series, and method
plotFan(ts, fc, "Y1", "1988", "A")
## Not run: 
# produces error because the input dataframes do not contain the "timestamp_dbo" column
plotFan(example1_TSTS, example1_FTS, "Y1", "1988", "A")

## End(Not run)

forvis/forvision documentation built on April 30, 2020, 3:28 a.m.