R/measure.mae.R

Defines functions measure.mae

Documented in measure.mae

#' @title Mean absolute error
#' @description Function to compute the mean absolute difference between the observed and predicted time series.
#' @author Daniel San-Mart\'in \email{daniel@@predictia.es}, J. Bedia, D. San-Mart\'in, S. Herrera
#' @template templateMeasureParams
#' @param dates dates
#' @return A float number corresponding to the mean absolute difference between the predicted and observed series.
#' @export


measure.mae <- function(indexObs = NULL, indexPrd = NULL, obs = NULL, prd = NULL, dates) {
      if (length(obs) <= 1) {
            stop("Observed time series is needed")
      }
      if (length(prd) <= 1) {
            stop("Predicted time series is needed")
      }
      index.mean(abs(prd - obs))
}
SantanderMetGroup/R_VALUE documentation built on July 4, 2023, 4:27 a.m.