Let's say I have have multiple values: [12, 8, -6, 0, -1] with weights [20%, 20%, 30%, 15%, 15%], how could I calculate its weighted average or mean?
Is it possible we can calculate weighted average or mean including negative numbers? Thanks.
For arithmetic mean, its quite simple for the array:
(12 + 8 - 6 + 0 - 1)/5 = 13/5 = 2.6
Reference:
https://stackoverflow.com/questions/3764795/weighted-average-with-a-negative-number
Based on the comment of @Ethan Bolker, since the sum of weights is $1$, the weighted mean of $$[12, 8, -6, 0, -1]$$ with weights $$[20\%, 20\%, 30\%, 15\%, 15\%]$$ can be calculated by:
$$12*0.2 \,+\, 8*0.2 \,-\, 6*0.3 \,+\, 0*0.15 \,-\, 1*0.15 \,=\, 2.05$$