Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/plotFixedOrigin.R
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.
1 2 | plotFixedOrigin(ts, fc = NULL, series, origin, 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. |
origin |
origin_timestamp for the origin 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 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
.
a dygraph object containing the fixed origin 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 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.