K. I'm tired and can't seem to wrap my mind around this.
Equation for averages: (A+B+C) / Number Of Values
How would you add weight to different values for the averaging?
Example:
I want A to influence 50% of the average, and B & C would be 25%. I know I could just add multiples of A but that isn't exactly as flexible as I'd like.
ID:158596
![]() Jul 31 2009, 10:05 pm
|
|
![]() Jul 31 2009, 10:32 pm
|
|
(A*aweight + B*bweight + C*cweight) / totalweight
|
Doesn't matter (100/100 = 0.1/0.1), though I suggest you use whole numbers to avoid rounding errors, though they'd likely be insignificant here.
|
Well if I multiplied them by the full number i'd have to divide by Number of values * 100. Or I'd end up with an obnoxiously large number. :)
|
Nielz wrote:
But wouldn't that just result in always '1', in stead of the average weight? True sir. :) |
No, that would be the sum total of the product of the weights and the values.
A: 50 weight B: 40 weight C: 30 weight (A*50 + B*40 + C*30) / (50 + 40 + 30) Notice that the weights do not need to add up to any specific value because whatever they add up to, you're dividing by that. Naturally, they COULD all add up to 1, but there's no reason for them to do so unless you were specifically trying to find each one's contribution. Notice it also reduces to the unweighted average when the weights are all equal to each other. |
Wow. I'm really dumb.
You're completely right. I was just applying the formula like a dumbass. Thanky for tolerating our ignorance. |
The way you write the formula, A, B and C should represent the number of objects that have these specific weights (30, 40 and 50), so: [A] objects weighing 30, [B] objects weighing 40 and [C] objects weighing 50
Let's say A is 5, B is 3 and C is 2, the formula would look like this: (5*30 + 3*40 + 2*50) / (5 + 3 + 2) = (150 + 120 + 100) / (5 + 3 + 2) = 370/10 = 37 We have an average weight of 37 here, why seems right if you look at the above weights. When calculating averaging, you always need to divide by the total number of measurement objects. If I were to go with your formula, it would be: (5*30 + 3*40 + 2*50) / (30 + 40 + 50) = 370/120 = 3.08 (this is obviously not the average weight in a list of 30, 40 and 50) |
Nielz wrote:
If I were to go with your formula, it would be: You are absolutely correct, 3.08 is NOT the average weight in a list of 30/40/50... But it IS however the average weight in a list of 2,3,4 (when those values are weighted, of course). Read what he said carefully. The weights are 30/40/50, not 2/3/4. 2/3/4 are the values, and their average is appropriate. Garthor wrote: A: 50 weight |