fg_sweep Augments a sweep::sw_sweep() output into fgts_dygraph() forecastdataset format. See
Introduction to Sweep
Arguments
- swept_data
Data resulting from a
sweep::sw_sweep()call- confidence
(Default: 80) Confidence interval (in percent) to display
Value
data.table suitable for passing into fgts_dygraph() via the forecastdataset parameter
Examples
if (
requireNamespace("forecast", quietly = TRUE) &
requireNamespace("timetk", quietly = TRUE) &
requireNamespace("sweep", quietly = TRUE)
) {
fcst_eqtypx <- timetk::tk_ts(eqtypx[,.(date,QQQ)]) |> forecast::ets() |>
forecast::forecast(h=30) |> sweep::sw_sweep(timetk_idx=TRUE)
fcst_in <- fg_sweep(fcst_eqtypx)
toplot <- eqtypx[,.(date,IBM,QQQ)]
fgts_dygraph(toplot,title="With Forecasts", roller=1,dtstartfrac=0.7,forecast_ds=fcst_in)
}
#> Warning: Non-numeric columns being dropped: date
#> Warning: 'tzone' attributes are inconsistent