R/sMAPE.R

Defines functions sMAPE

Documented in sMAPE

sMAPE <-
function(actual, prediction) {
  if (length(actual) != length(prediction)) stop("actual and prediction have different lengths")
  
  n <- length(actual)
  
  res <- (1/n) * sum(abs(actual-prediction) / ((abs(actual)+abs(prediction))/2))
  res
}

Try the TSPred package in your browser

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

TSPred documentation built on June 26, 2018, 5:04 p.m.