# Is it possible to calculate the probability the sum of one set of random variables equals the sum of a different set of random variables?

I'm doing data analysis at the business I work for. 23 people were asked for input for two separate lists. The first list the answers could be any integer 6 to 10. The second list the answers could be any integer 0 to 15. After receiving all inputs, the average number chosen for each list was identical. For the average to be identical so was the sum. Is it possible to calculate the probability the two sums were equal even though they drew from different ranges?

The original question was how much would a prospective baby weigh. 23 people answered with a guess of pounds and additional ounces. The pounds were limited 6 to 10 and the ounces were limited 0 to 15. There was no discernible connection between the guess of pounds to the guess of ounces.

Also, I need help with the calculation in addition to a yes or no answer. I need a calculation over results obtained through simulation but thank you for those results as well.

I would comment on posts, however, I am not allowed to yet.

• yes it is possible! – Xi'an Jun 19 '18 at 19:19
• Yes, it is possible, buy you need to do some assumptions about how answers are distributed and about whether they are independent. For example, if the questions were "what day number is today" you are very likely to get the same means. – Pere Jun 19 '18 at 19:48
• Please register &/or merge your accounts (you can find information on how to do this in the My Account section of our help center), then you will be able to edit & comment on your own question. – gung - Reinstate Monica Jun 19 '18 at 20:33
• +1 at first I overlooked the inch vs ounces difference and thought this was a question about different scales for the same question. In that alternative sense this is a relevant question. For instance when comparing psychological effects in the use of different type of scales. The low probability estimate for (near) similarity (calculated with uniform distributions) could make one assume that the scales behave similarly or do not differ significantly. – Sextus Empiricus Jun 25 '18 at 14:58

Yes it is possible, and the other answers/comments have shown how you can calculate/approximate the probability.

But this is probably (I imagine) not what you want. If you want to show the probability that people respond similar or different on two different scales then it is a bit simplistic to compare them to people that just randomly pick uniform numbers. We are not speaking of random dice rolls.

The current setup gives a low 1.5% probability that the two sets end up with the same sum (as answered and commented by others). So you might be tempted to assume that you have an extreme case of similarity (ie reject the hypothesis that the sums are not gonna end up the same). If you had a larger range for the pounds then you probably would have had the same equal sum (since few newborns are less than 6 or more than 10 pounds), but the theoretical naively calculated probability would be extremely low.

• estimate of ounces. This is probably gonna end up in the middle around 7.5 since not so many people know the precision and are just estimating like picking a uniformly distributed random number. (possibly a bit lower than 7.5 since people might tend to place the estimate behind the comma more low or leave it out)
• estimate of the pounds. Since the average newborn is close to between 7 an 8 you are very likely gonna end up with a mean somewhere close to 7.

This makes it much more likely that the sum of ounces and sum of inches are gonna match. (in comparison to the 1.5% based on uniform picks)

You could use your data to create estimates of the distributions how people will prospect birth weight (for the pounds I would model with a multinomial with the events 6,7,8,9,10, for the ounces I would model with a beta distribution).

Based on those estimates of the distributions you could estimate the probability for any other new group of 23 people (from the same population) to again produce the same sum of the two different sets of random variables.

• +1, because this addresses the implicit statistical question rather than giving the easy purely mathematical answer. – whuber Jun 25 '18 at 16:21

The answer depends on the assumptions made as to how the answers are generated. Is each number on the list equally likely to be drawn? And very importantly, what dependency, if any, is there between the answers provided for the two lists by the same person?

Based on your comment elsewhere, you maintain that all numbers are drawn equally likely and independent across all lists and people. Under these assumptions, it's easy to estimate an answer by simulation (results provided below). It is possible, but more difficult, to compute an exact answer without resorting to simulation - I leave such calculation to any eager beavers who wish to perform it.

Here are the results of a MATLAB simulation with 10 million replications of the problem for j people, where j is varied from 1 to your desired number of 23. The first column is j, the 2nd column is the approximate probability of sums over j people being equal for lists 1 and 2. The results are accurate to roughly +/- 1 in the last digit shown. The exact result for j = 1 is 1/16 = 0.625, because for whatever number is chosen for list 1, there is a 1 out of 16 probability that the list 2 number will match it.

>> for j=1:23, disp([j mean(sum(randi([6 10],j,1e7),1)==sum(randi([0 15],j,1e7),1))]), end
1.0000    0.0625
2.0000    0.0555
3.0000    0.0449
4.0000    0.0393
5.0000    0.0352
6.0000    0.0321
7.0000    0.0297
8.0000    0.0277
9.0000    0.0259
10.0000    0.0246
11.0000    0.0232
12.0000    0.0221
13.0000    0.0213
14.0000    0.0204
15.0000    0.0196
16.0000    0.0189
17.0000    0.0182
18.0000    0.0177
19.0000    0.0170
20.0000    0.0166
21.0000    0.0161
22.0000    0.0156
23.0000    0.0152

• +1. But perhaps a more revealing, and computationally much easier solution, would be to use the Normal approximation to the distribution of the difference: it gives $0.01524\ldots$ A fully accurate efficient method uses the FFT to compute the exact distribution. If I didn't make any indexing errors in a quick one-off calculation, the value is $0.01520005\ldots$; the elapsed time was 0.002 seconds. – whuber Jun 19 '18 at 20:15
• @whuber +1 O.k, you get the eager beaver award. – Mark L. Stone Jun 19 '18 at 20:18
• It was dead easy: I just used a simplification of the code in my answer at stats.stackexchange.com/a/291571/919, which covers this situation. The Normal approximation calculation is a quick pencil-and-paper thing, arguably the easiest approach of all. – whuber Jun 19 '18 at 20:19

As stated above: it's all in the assumptions. If the numbers in each range are equally likely and the 23 folks choose independently, the brute force method to get an exact answer is to use probability generating functions.

Here is a Mathematica implementation:

pgf1 = Sum[t^i (1/5), {i, 6, 10}]^23;
pgf2 = Sum[t^i (1/16), {i, 0, 15}]^23;
pr1 = Table[Coefficient[pgf1, t^i], {i, 6*23, 10*23}];
pr2 = Table[Coefficient[pgf2, t^i], {i, 6*23, 10*23}];
Total[pr1 pr2]


$$\frac{448626236408308149794568086913862442605587}{29514790517935282585600000000000000000000000}$$

or approximately 0.01520004813.

Update

Here is the equivalent in R:

library(polynom)
n = 23
p1 = polynomial(c(0,0,0,0,0,0,rep(1/5,5)))^n
p2 = polynomial(rep(1/16,16))^n

c1 = coef(p1)[(6*n+1):(10*n+1)]
c2 = coef(p2)[(6*n+1):(10*n+1)]

sum(c1*c2)
# 0.01520005