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

14

u/LoaderD MSc Statistics Sep 15 '24

It’s so disheartening to see how much work you put into this and OP is brushing it away.

It really kills the vibe of the sub when the mods just let people spam questions without requiring any work or constructive discussion on the OP’s side

7

u/SalvatoreEggplant Sep 15 '24

In this case, the posts on r/AskStatistics and r/Rlanguage were posted at the same time.

-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.