plotFixedOrigin: Fixed origin graph

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

View source: R/plotFixedOrigin.R

Description

Plots the fixed origin graph showing point forecasts produced for the same time series from the same origin, with different horizons. Forecasts can relate to one method or to a set of alternative methods.

Usage

1
2
plotFixedOrigin(ts, fc = NULL, series, origin, 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.

origin

origin_timestamp for the origin 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 origin and series_id and containing forecasts produced by methods included in methods,

2) plot point forecasts, 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 origin graph.

Author(s)

Cuong Sai, Andrey Davydenko, and Maxim Shcherbakov.

See Also

plotFan, plotFixedHorizon

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 origin, series, and method
plotFixedOrigin(ts, fc, "Y1", "1988", "A")
## Not run: 
# produces error because the input dataframes do not contain the "timestamp_dbo" column
plotFixedOrigin(example1_TSTS, example1_FTS, "Y1", "1988", "A")

## End(Not run)

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