Leihua Ye, PhD
Apr 14, 2021

--

Hi Howard, I tried your code and got the same results as yours: there is a 9.95% for getting 1, 18.4% for getting 2, 22.41% for getting 3, and 49.24% for getting 4.

For a short array like [1,2,3,4], the empirical probabilities of getting these numbers are reasonably accurate. Think about this: the chance of getting 4 out of the sum of the array is 4/(1+2+3+4) = 0.4.

If you have a much longer array, the emprical distribution will move closer to the theoretical distribution.

Hope it helps!

--

--

Leihua Ye, PhD

Senior Data Scientist @ Walmart; PhD @ University of California. Data Science | A/B Test & Causal Inference | Career www.linkedin.com/in/leihuaye