Mean Absolute Error
=====================================================
The Mean absolute error (MAE) is a measure of the Average difference between two values, calculated as the sum of the absolute differences divided by the number of observations.
Definition
The Mean absolute error (MAE) is defined as:
M AE = (1 / n) * ∑|xi - x̄|
where:
- M AE is the Mean absolute error
- xi are individual values in the dataset
- x̄ is the Mean of the dataset
- n is the number of observations
History
The concept of MAE was first introduced by George F. Hotelling in 1932, who used it to measure the Average difference between two sets of data.
Formula
The formula for calculating MAE can be simplified as follows:
M AE = (1 / n) * ∑|xi - x̄|
Where:
- M AE is the Mean absolute error
- xi are individual values in the dataset
- x̄ is the Mean of the dataset
Properties
The MAE has several important properties:
- Symmetry: The MAE is symmetric, meaning that MAE(x, y) = MAE(y, x).
- Non-negativity: The MAE is non-negative, meaning it cannot be negative.
- Consistency: The MAE is consistent, meaning that it converges to the true Average difference as the number of observations increases.
Applications
The MAE has many applications in various fields, including:
- Finance: MAE is used to measure the difference between stock prices and their forecasted values.
- Engineering: MAE is used to measure the difference between experimental results and theoretical predictions.
- Healthcare: MAE is used to measure the difference between actual treatment outcomes and predicted outcomes.
Example Use Cases
- Stock Market Analysis: Suppose we have two stock prices, x = 100 and y = 120, and their forecasted values are x̄ = 110 and ȳ = 130. The MAE can be calculated as:
M AE = (1 / n) * (∣100 - 110∣ + ∣120 - 130∣)
Code
Here is an example of how to calculate the MAE using Python:
import numpy as np
# Define the data
x = np.array([100, 105, 110, 115, 120])
y = np.array([110, 115, 120, 125, 130])
# Calculate the [Mean](/Mean) absolute error
mae = (1 / len(x)) * np.sum(np.abs(x - y))
print("[Mean](/Mean) Absolute Error:", mae)
Conclusion
The Mean absolute error is a widely used measure of the difference between two values, calculated as the sum of the absolute differences divided by the number of observations. It has several important properties and applications in various fields, including finance, engineering, and healthcare.