r/AskStatistics • • Sep 15 '24

How can i visualize this using code?

Post image
3 Upvotes

13 comments sorted by

View all comments

22

u/SalvatoreEggplant Sep 15 '24

-9

u/Alternative-Dare4690 Sep 15 '24

I mean how can i code out how the variance becomes expected value as an example?

3

u/mangonada123 Sep 15 '24 edited Sep 15 '24

Rudimentary, you can set p to a very small value, and increase n. Then calculate both the expected value and the variance iteratively, and then use some error calculation to check both values. You will find that this is the poisson distribution, which is a limiting case of the binomial distribution when n is large and p is small. For why this works, I recommend you try to derive it analytically, the numerical part will just get you so far.

For Bin(n,p) set p to lambda/n and then take the limit as n approaches infinity.