I have read some pages about how to calculate the average of percents. However, still I don't understand something...

Assume data points are organized in the following manner: We have two categories and each category contains some malware files. We run a virus detection program to see how many files are detected as malware. So, for SET1, there are 30 files and we have detected 25 viruses. The coverage is then 83.3%. The same is true for SET2.

          items         detected          percent 
 set1      30              25              83.3%
 set2      80              40              50%

Now, we want to know what is the average coverage for this program. We have two methods:

1- We can say, there are totally 110 files (30+80) and totally 65 files (25+40) are detected. So, the average coverage is 65*100/110 which is 66.6%

2- We can calculate (83.3+50)/2 which is 59%.

Which one is more meaningful?

  • $\begingroup$ Related question and answer: stats.stackexchange.com/a/144067/168251 $\endgroup$ – afagarap Dec 28 '18 at 9:11
  • $\begingroup$ That is talking about measurements in time. However, mine is not related to time. So, I think that is not applicable here. $\endgroup$ – mahmood Dec 28 '18 at 9:16
  • $\begingroup$ You could average it as how you would regularly do it, unless the percentages are weighted. $\endgroup$ – afagarap Dec 28 '18 at 9:18
  • 4
    $\begingroup$ Both are equally "correct," depending on what this average is intended to estimate. Please edit your post to clarify what the purpose of your analysis might be. $\endgroup$ – whuber Dec 28 '18 at 16:03
  • 1
    $\begingroup$ @whuber: I have edited the post with more details. $\endgroup$ – mahmood Dec 31 '18 at 12:34

59% is correct.

You can caluclate it like this: (30 * 83.3% + 80 * 50%)/110 = 59%

The problem with averaging percentages directly is that you don't take into account the numbers that these percentages refer to. If you had the equal number of elements in set1 and set2, you'd get the same result, but since one set has more elements than the other, the percentage has to be weighted.

  • $\begingroup$ But (83.3+50)/2 is not weighted as far as I could understand. Both numbers are normalized to 100. $\endgroup$ – mahmood Dec 28 '18 at 9:57
  • $\begingroup$ 83% of 30 is not the same as 83% of 1000000. That's the whole point. $\endgroup$ – Kresimir Dec 28 '18 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.