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".

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

`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. |

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"`

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.

Jose Augusto Fiorucci and Francisco Louzada

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
``` |

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

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

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