https://github.com/cran/ftsa
Raw File
Tip revision: e7bc5a319919d3a605a8f6073cb4e4ae44b35713 authored by Han Lin Shang on 25 April 2017, 06:42:50 UTC
version 4.8
Tip revision: e7bc5a3
mdase.R
mdase = function(forecast, outsampletrue, insampletrue)
{
	if(length(forecast) != length(outsampletrue))
		stop("MdASE: the lengths of input vectors must be the same.")
	n = length(insampletrue)
	insamplerr = vector(, (n - 1))
	for(i in 1:(n - 1))
	{
		insamplerr[i] = abs(insampletrue[i+1] - insampletrue[i])
	}
	qt = (outsampletrue - forecast)/(sum(insamplerr)/(n - 1))
	scalederror = median(abs(qt))
	return(round(scalederror, 6))
}
back to top