R/cal_m4measures.R

Defines functions cal_m4measures

Documented in cal_m4measures

#'Mean of MASE and sMAPE
#'
#'Calculate MASE and sMAPE for an individual time series
#'
#'@param training training period of a time series
#'@param test test peiod of a time series
#'@param forecast forecast obtained from a fitted to the training period
#'@return returns a single value: mean on MASE and sMAPE
#'@author Thiyanga Talagala
#'@export
#'@examples
#'require(Mcomp)
#'require(magrittr)
#'ts <- Mcomp::M3[[1]]$x
#'fcast_arima <- auto.arima(ts) %>% forecast(h=6)
#'cal_m4measures(M3[[1]]$x, M3[[1]]$xx, fcast_arima$mean)
cal_m4measures <- function(training, test, forecast){
  method_MASE <- cal_MASE(training, test, forecast)
  method_sMAPE <- cal_sMAPE(training, test, forecast)
  measures <- c(MASE=method_MASE, sMAPE=method_sMAPE)
  return(measures)
}

Try the seer package in your browser

Any scripts or data that you put into this service are public.

seer documentation built on Oct. 1, 2022, 9:06 a.m.