In statistics, you make forecasts based on the data you have available. Unfortunately, the forecasts don't always match with the actual values generated by the data. Knowing the difference between the forecasts and the actual values of your data is useful as it can help you refine future forecasts and make them more accurate. To find out how much of a difference there is between your forecasts and the actual value produced, you need to calculate the mean absolute error (also known as MAE) of the data.
Calculate SAE
Before you can calculate the MAE of your data, you first need to calculate the sum of absolute errors (SAE). The formula for SAE is
which may appear confusing at first if you aren't used to sigma notation. The actual procedure is fairly straightforward, however.
Subtract the true value (signified by xt) from the measured value (signified by xi), possibly generating a negative result depending on your data points. Take the absolute value of the result to generate a positive number. As an example, if xi is 5 and xt is 7:
The absolute value of −2 (signified by | −2|) is 2.
Repeat this process for each set of measurements and forecasts in your data. The number of sets is signified by n in the formula, with the
indicating that the process starts at the first set (i = 1) and repeats a total of n times. In the previous example, assume that the previous points used were one out of 10 pairs of data points. In addition to the 2 generated before, the remaining point sets generate absolute values of 1, 4, 3, 4, 2, 6, 3, 2 and 9.
Add the absolute values together to generate your SAE. For the example, this gives us
Calculate MAE
Once you calculate the SAE, you have to find the mean or average value of the absolute errors. Use the formula
to get this result. You may also see the two formulas combined into one, which looks like
but there is no functional difference between the two.
Divide your SAE by n, which as mentioned above is the total number of point sets in your data. Continuing with the previous example, this gives us
Round your total to a set number of significant digits if required. There is no need for this in the example used above, but a calculation providing figures such as MAE = 2.34678361 or a repeating figure may need rounding to something more manageable like MAE = 2.347. The number of trailing digits used depends on personal preference and the technical specifications of the work you do.
References
About the Author
Holding a BS in computer science and several years of experience building, repairing and maintaining computers and electronics, Jack Gerard has had a love of science and mathematics for years. When not working on writing projects as part of his 15+ year career, he also works as a programmer writing gaming and accessibility software.