0
$\begingroup$

I apologize for the horrific title, but I can't accurately express what I want to ask. If I have eight observations with two groups with each observation having a numerator and denominator values, the result variable is simply numerator / denominator:

name  group numerator denominator result
A         1        12          34  0.353
B         1        15          40  0.375
C         1        10          20  0.5  
D         1      1000        1200  0.833
E         2       120         150  0.8  
F         2        80         100  0.8  
G         2       150         200  0.75 
H         2       130         150  0.867

I am interested in the group means of the result:

group group_mean
    1      0.515
    2      0.804

However, in this scenario, observations A, B, and C are clearly driving the mean of group 1 down, even though observation D should clearly have more weight than the other ones. How should I correctly weight observations is this scenario? This seems like such a straightforward thing, but the fact that result is already a proportion, I'm having a difficulty figuring out the correct way of doing it. Thanks.

$\endgroup$
2
$\begingroup$

I think that you are looking for frequency weights. You should be weighting by denominator. (You can also use sampling weights - this will give the same mean). Most software has this function.

One easy way to do this is to calculate group_mean as sum(numerator) / sum(denominator).

A second way, if you already have the result column is to calculate sum(result * denominator) / sum(denominator).

$\endgroup$

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.