plotFixedHorizon: Fixed horizon graph

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

View source: R/plotFixedHorizon.R

Description

Plots a graph showing point forecasts produced for the same time series, with the same horizon, but from various rolling origins. Forecasts can relate to one method or to a set of alternative methods.

Usage

1
2
plotFixedHorizon(ts, fc = NULL, series, h, method = NULL,
  graphLib = "dygraph")

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. if NULL, forecasts are not shown on the graph.

series

series_id for the time series to be shown.

h

forecast horizon for the horizon of the forecast to be shown.

method

method_id for the method to be shown.

Details

Uses the following algorithm to plot the graph:

1) select all the forecasts from fc having the specified series_id, horizon, and method

2) plot point forecasts for the rows selected, use different colors for different methods

3) plot actuals contained in ts for the given series_id

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

Value

a dygraph object containing the fixed horizon graph.

Author(s)

Cuong Sai, Andrey Davydenko, and Maxim shcherbakov.

See Also

plotFan, 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 a graph for some given horizon, series, and method
plotFixedHorizon(ts, fc, "Y1", 1, "A")
## Not run: 
# produces error because the input dataframes do not contain the "timestamp_dbo" column
plotFixedHorizon(example1_TSTS, example1_FTS, "Y1", 1, "A")

## End(Not run)

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