#' @title MAPE
#' @description Mean Absolute Percentage Error of Forecast against Response
#' @param actual vector or list of reported/response values
#' @param predicted vector or list of predicted values
MAPE = function(actual, predicted){
if(is.list(actual)){actual <- as.numeric(unlist(actual))}
if(is.list(predicted)){predicted <- as.numeric(unlist(predicted))}
mean(abs((actual[actual!=0] - predicted[predicted!=0]) / actual[actual!=0]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.