Learn R Programming

ehaGoF (version 0.1.1)

Goodness of Fit - Mean Absolute Percentage Error: Mean Absolute Percentage Error

Description

Calculates and returns the goodness of fit criterion: mean absolute percentage error (MAPE), a.k.a. mean absolute percentage deviation or MAPD.

Usage

gofMAPE(Obs, Prd, dgt=3)

Arguments

Obs

Observed values or targets.

Prd

Predicted or expre-ected values produced by the model.

dgt

Number of digits in decimal places. Default is 3.

Value

MAPE

Mean absolute percentage error (MAPE) of given set.

Details

Mean absolute percentage error (MAPE) is a measure of prediction accuracy of a forecasting method in statistics. It is commonly used as a loss function for regression problems and in model evaluation, for its very intuitive interpretation in terms of relative error. It usually expresses accuracy as a percentage.

References

Comparison of the Predictive Capabilities of Several Data Mining Algorithms and Multiple Linear Regression in the Prediction of Body Weight by Means of Body Measurements in the Indigenous Beetal Goat of Pakistan, Ecevit Eyduran, Daniel Zaborski, Abdul Waheed, Senol Celik, Koksal Karadas and Wilhelm Grzesiak, Pakistan J. Zool., vol. 49(1), pp 257-265, 2017.

Prediction of Selected Reproductive Traits of Indigenous Harnai Sheep under the Farm Management System via various Data Mining Algorithms - Daniel Zaborski, Muhammad Ali, Ecevit Eyduran, Wilhelm Grzesiak, Mohammad Masood Tariq, Ferhat Abbas, Abdul Waheed, Cem Tirink - Pakistan journal of zoology, 2019

Comparison of Different Data Mining Algorithms for Prediction of Body Weight From Several Morphological Measurements in Dogs - S Celik, O Yilmaz

Examples

Run this code
# NOT RUN {
# dummy inputs, independent variable
# integers from 0 to 9
inputs <- 0:9

# dummy targets/observed values, dependent variable
# a product of 2*times inputs minus 5 with some normal noise
targets <- -5 + inputs*2 + rnorm(10)

# linear regression model
model<-lm(targets~inputs)

# model's predicted values against targets
predicted<-model$fitted.values

# using library ehaGoF for goodness of fit.
library(ehaGoF)

# Goodness of fit - mean absolute percentage error statistics
gofMAPE(targets, predicted)
# }

Run the code above in your browser using DataLab