errorMetricFunctions: Error Metric Function

Description Usage Arguments Details Value Author(s) See Also Examples

Description

This function implements some of the more used error metrics. These metrics are "sMAPE", "MAPE", "MAE", "MSE" and they respectively versions with median "sMdAPE", "MdAPE", "MdAE", "MdSE".

Usage

1
	errorMetric(obs, forec, type="sAPE", statistic="M")

Arguments

obs

A vector or a matrix with the real values.

forec

A vector or a matrix with the estimated values.

type

The error type of "sAPE", "APE", "AE" and "SE".

statistic

The statistic to be returned. Use "M" or "Md" for return the mean or median of the errors. If "N" so a vector with all errors will be returned.

Details

The metric sMAPE is obtained using type = "sAPE" and statistic = "M"

The metric sMdAPE is obtained using type = "sAPE" and statistic = "Md"

The metric MAPE is obtained using type = "APE" and statistic = "M"

The metric MdAPE is obtained using type = "APE" and statistic = "Md"

The metric MAE is obtained using type = "AE" and statistic = "M"

The metric MdAE is obtained using codetype = "AE" and statistic = "Md"

The metric MSE is obtained using type = "SE" and statistic = "M"

The metric MdSE is obtained using type = "SE" and statistic = "Md"

Value

If statistic="M" or statistic="Md" it is returned the respectively error metric result. If statistic="N" so is returned a vector with all errors points according to the chosen error type.

Author(s)

Jose Augusto Fiorucci and Francisco Louzada

See Also

forecTheta-package, groe

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
##############################################################	

y1 = 2+ 0.15*(1:20) + rnorm(20,2)
y2 = y1[20]+ 0.3*(1:30) + rnorm(30,2)
y =  as.ts(c(y1,y2))

out <- dotm(y=as.ts(y[1:40]), h=10)

### sMAPE metric
errorMetric(obs=as.ts(y[41:50]), forec=out$mean)

### sMdAPE metric
errorMetric(obs=as.ts(y[41:50]), forec=out$mean, statistic = "Md")

### MASE metric
meanDiff1 = mean(abs(diff(as.ts(y[1:40]), lag = 1)))
errorMetric(obs=as.ts(y[41:50]), forec=out$mean, type = "AE", statistic = "M") / meanDiff1

forecTheta documentation built on May 19, 2017, 6:20 p.m.

Search within the forecTheta package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.