chart_forecast_error {OOS}R Documentation

Chart forecast errors

Description

Chart forecast errors

Usage

chart_forecast_error(Data, Title, Ylab, Freq, zeroline = FALSE)

Arguments

Data

data.frame: oos.forecast object

Title

string: chart title

Ylab

string: y-axis label

Freq

string: frequency (acts as sub-title)

zeroline

boolean: if TRUE then add a horizontal line at zero

Value

ggplot2 chart

Examples



 # simple time series
 A = c(1:100) + rnorm(100)
 date = seq.Date(from = as.Date('2000-01-01'), by = 'month', length.out = 100)
 Data = data.frame(date = date, A)

 # run forecast_univariate
 forecast.uni =
   forecast_univariate(
     Data = Data,
     forecast.dates = tail(Data$date,10),
     method = c('naive','auto.arima', 'ets'),
     horizon = 1,
     recursive = FALSE,
     freq = 'month')

 forecasts =
   dplyr::left_join(
     forecast.uni,
     data.frame(date, observed = A),
     by = 'date'
   )

 # chart forecast errors
 chart.errors =
   chart_forecast_error(
     forecasts,
     Title = 'test',
     Ylab = 'Index',
     Freq = 'Monthly',
     zeroline = TRUE)




[Package OOS version 1.0.0 Index]