https://github.com/cran/ftsa
Tip revision: c3715412cc972271c2e6d9ee895aed21b6f67c41 authored by Han Lin Shang on 31 March 2011, 15:18:38 UTC
version 2.6
version 2.6
Tip revision: c371541
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))
}