Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/plotFanChart.R View source: R/plotFan.R
Draws a fan chart for forecasts for a specified method, time series, and origin.
1 2 |
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. |
graphLib |
choose method for disp |
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
.
A dygraph object with the fan chart.
Cuong Sai, Andrey Davydenko, and Maxim Shcherbakov.
plotFixedHorizon
, plotFixedOrigin
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.