0

I'm looking for a way to calculate the weighted average of a range of numbers, but where the lowest need to be 5% (and thus the total still needs to be 100%).

Let me try to explain:

[
0.98077,
0.99038,
0.99279,
0.99279,
0.99519
]

Weighted average is simple:

total = +- 5
And each is about 19-20%

The problem I'm having with this is that there is too little difference to differentiate between a good and the best. They're all the same (on a piechart).

So what I was thinking is: Let's assume the minimum = 5%. So: 0.98077 = 5%

But how to display this on the piechart? How can I calculate the other percentages?

Though their relative sizing should stay the same.

In this way I'm hoping that you will see a bigger difference.

I was thinking to remove the minimum from all of them:

[
0.0
0.009610000000000007,
0.01201999999999992,
0.01201999999999992,
0.014419999999999988,
]

But then I'm getting as weighted average:

[
0.0,
0.19991678801747537,
0.25005200748907763,
0.25005200748907763,
0.2999791970043694,
]

Which is already closer to what I need as now the differences are much better visible. However, the 0% isn't visible anymore.

So this part I want it to be 10%.

This is how it looks when drawing in excel. It's very visible the minimum is not as good as the others. Barchart in Excel

Thanks!

  • Please edit for clarity. The lowest what has to be $5%$? Weight? Well, make the weights whatever you want. What's the problem? Certainly that condition does not determine the weights uniquely, right? – lulu May 09 '22 at 13:08
  • So you want to keep the other weights (2,3,4,5) the same, but have them representing 90% of the total. Therefore the total of all five weights would need to be (2+3+4+5)/0.90 = 140/9. That leaves 140/9-(2+3+4+5)=14/9 for the first weight. You could of course scale all the weights by a factor of 9 to remove the fraction, to get (14,18,27,36,45) – Jaap Scherphuis May 09 '22 at 13:14

1 Answers1

1

numbers = [1, 2, 3, 4, 5]

total = 15

set specific number (e.g. 1) to be a certain weight e.g. 10%

Now you have 90% left to distribute among a total of 15-1=14

Now redistribute the weights for the remaining numbers:

[0.10 (10% for the first number), 2/14 * 0.9, 3/14 * 0.9, 4/14 * 0.9, 5/14 * 0.9]

Is this what you want?

kekpirat
  • 158
  • 5