R/Accuracy.R

Defines functions accuracy

Documented in accuracy

#'Accuracy of Model
#'
#' @param actual Actual value of the target variable
#' @param predicted Predicted/forecasted value of the target variable
#'
#' @return Accuracy of the fitted model
#' @export
#'
#' @examples
#' actual <- c(100, 150, 200, 250, 300, 350, 400, 450, 500, 550)
#' predicted <- c(95, 148, 210, 245, 290, 360, 395, 440, 510, 540)
#' accuracy(actual, predicted)
#'

accuracy <- function(actual,predicted) {
  deviation <- (actual - predicted)/actual
  m <- mean(deviation)
  accuracy <- 1 - abs(m)
  message("Accuracy of Model: ",accuracy , "\n")
}

Try the PerMat package in your browser

Any scripts or data that you put into this service are public.

PerMat documentation built on June 22, 2024, 10:55 a.m.