In our 3-part series on "How to Assess Sensor Accuracy" this week, our CTO Paolo shares how to use R² and MAE to determine if readings from an indicative monitor are good enough to trust. If you haven't already, please read the overview here and introduction to R² here first.

Mean Absolute Error (MAE) is calculated to determine the absolute difference between the measurements of a device under analysis and the measurements of a reference instrument. It is the average of the absolute value of the deviations between measurements of the two devices. In other words, it shows how different measurements from the two devices are in value.

The MAE has the same units as the measurements, and it goes from 0 to infinity.

• A low MAE means that the measurements from the device under test are very close in absolute value to the measurements from the reference instrument.
• A high MAE means that the measurements from the device under test are very far in absolute value from the measurements from the reference instrument.

A significant difference between MAE and R² is that MAE, having the same unit as the measurement, is interpreted with knowledge of the phenomenon that we are trying to monitor.

For example, if we are measuring the weight of a human being and we are calculating MAE score for a scale, we know that a MAE of 0.5 grams is acceptable, while a MAE of 0.5 kg is not. On the other end, if we are measuring the weight of a cargo ship, a MAE of 0.5 kg is perfectly acceptable.

### Covering R² Blind Spots with MAE

To see how MAE can be used to supplement the information given by R², let’s look back to the previous figures (copied below): Figure 6: Both graphs report R² equal to 0.0. On the top graph, MAE is equal to 35.23 𝞵g/m3, in the bottom one MAE is equal to 1.76 𝞵g/m3. Note that the y-axis range purposefully kept from 0 to 100 in both graphs to show the difference in the two datasets.

Once we calculate the R² and MAEs, we can add our knowledge of the phenomenon to the analysis. For the imaginary device that generated the top graph, no correlation with the reference instrument is observed (R² = 0.0). Furthermore, the average deviation between its measurements and the reference measurements (MAE) is 35.23 𝞵g/m3. Such deviation could lead to severe misclassification of air quality. This means that the device should be regarded as inaccurate for the purpose of monitoring ambient air quality.

For the imaginary device that generated the bottom graph, no correlation with the reference instrument is observed (R²= 0.0). However, the average deviation between its measurements and the reference measurements (MAE) is less than 2 𝞵g/m3. This means that, in principle, the device might be able to correctly classify air quality, and the low R² could be the result of a low range of pollutant concentrations during the test. In this case, it is recommended to repeat the test with a wider pollutant concentration.

One more thing to keep in mind during experimental data analysis is that the MAE metric is not a good indicator of correlated deviations that can be corrected through calibration, or deviations that are caused by random errors or limitations of the device under analysis which cannot be corrected. All kinds of deviations increase MAE equally. A device under analysis with a high R² that perfectly tracks changes in pollutant concentration, but is off by a factor potentially due to a poor calibration, might have a similar MAE to a broken device that always outputs the same number. Luckily, a high R² can point to the possibility of calibrating the device under analysis. Figure 7: Measurements time series and scatterplot for two imaginary devices under analysis and reference instruments that are measuring PM2.5 over time. One device is uncalibrated, the other is broken. Both devices have the same MAE.

To avoid the pitfalls of MAE, Clarity recommends to also calculate and report R² with MAE.

If you have any additional questions about MAE or assessing sensor accuracy, please reach out to our team at contact@clarity.io.
{"ft_lang_label":"__label__en","ft_lang_prob":0.93372834,"math_prob":0.9399558,"size":3572,"snap":"2022-27-2022-33","text_gpt3_token_len":760,"char_repetition_ratio":0.14882287,"word_repetition_ratio":0.105610564,"special_character_ratio":0.20296752,"punctuation_ratio":0.089705884,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95056343,"pos_list":[0,1,2,3,4],"im_url_duplicate_count":[null,8,null,4,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-07-04T20:33:16Z\",\"WARC-Record-ID\":\"<urn:uuid:eaffb5a0-19db-43e4-b878-914f1849cd78>\",\"Content-Length\":\"26221\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:3b366730-4300-4f1a-87f2-21da371abbab>\",\"WARC-Concurrent-To\":\"<urn:uuid:fbca844b-18a2-4e7b-af9c-9d6557b31000>\",\"WARC-IP-Address\":\"44.207.21.146\",\"WARC-Target-URI\":\"https://www.clarity.io/blog/how-to-assess-sensor-accuracy-mae\",\"WARC-Payload-Digest\":\"sha1:R7X5ZDHZ4TNKRHIZSGDQL3UA2PC3YATF\",\"WARC-Block-Digest\":\"sha1:EXUHFGV5BBXGZZYFZV2ANIUS6DYARBQW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656104496688.78_warc_CC-MAIN-20220704202455-20220704232455-00055.warc.gz\"}"}