Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/plotFixedHorizon.R
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.
1 2 | plotFixedHorizon(ts, fc = NULL, series, h, method = NULL,
graphLib = "dygraph")
|
ts |
dataframe containing time series actuals formatted using the Time Series Table Schema (TSTS),
use |
fc |
dataframe containing forecasts formatted using the Forecast Table Schema (FTS), use |
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. |
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
.
a dygraph object containing the fixed horizon graph.
Cuong Sai, Andrey Davydenko, and Maxim shcherbakov.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.