I am currently coding a script which displays data for a company intranet. I am stuck with a question that seemed pretty simple, but turned out to give me headaches.
We have the following scenario:
- Store A has 70 male customers and 100 female customers – (170 total)
- Store B has 50 male customers and 230 female customers – (280 total)
Now, I learned that in order to display the average male/female ratio I have to calculate:
$$\frac{\text{Male Store A} + \text{Male Store B}}{170 + 280} = X $$
$X * 100 = 28.9\%$ for males, $71.1\%$ for females
Yet when thinking it over, it doesn't show the real average, because the total number of clients isn't the same (170 vs 280).
So I did a second approach, which is first separating the percentage by store, and then calculating the average percentage:
- Males, Store A: $\cfrac{70}{170} * 100 = 41.2\%$
- Males, Store B: $\cfrac{50}{280} * 100 = 17.9\%$
And then divide it:
$$\frac{41.2\% + 17.9\%}{2} = 29.6\% $$
So in the second case, rounded up, male ratio is 29.6% instead of 27.3%
Then I showed both calculations to somebody who is better in math then me, and he told me that both are wrong. He said I should use "weighted average", but when I do i get exactly the same average percentage like in the first calculation.
What am I doing wrong?
Background:
We have a lot of stores, each with a different number of female and male clients. I want to have a percentage of the average client gender, but taking into account the different amount of the guests in each store.
Best Answer
Okay, so I decided to stick to the weighted average method. Here is a good calculator to cross check your results:
http://www.handymath.com/cgi-bin/average.cgi