https://github.com/cran/ftsa
Raw File
Tip revision: dcfe93af93fb6e2561a282f315e5a776c1fac668 authored by Han Lin Shang on 19 November 2010, 13:26:02 UTC
version 2.2
Tip revision: dcfe93a
mdase.R
mdase = function(forecast, true)
{ 
  if (length(forecast) != length(true))
      stop("MdASE: the lengths of input vectors must be the same.")
  n = length(true)
  truerror = vector(, n - 1)
  for(i in 1:(n - 1)){
      truerror[i] = abs(true[i + 1] - true[i])
  }
  qt = (true - forecast) / (sum(truerror) / (n - 1))
  scalederror = median(abs(qt))
  return(round(scalederror, 6))
}
back to top