https://github.com/cran/ftsa
Tip revision: 4a78d06e146c9b6801d50fb15c2f67ce174c8c79 authored by Han Lin Shang on 08 June 2010, 07:47:32 UTC
version 1.9
version 1.9
Tip revision: 4a78d06
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))
}