r/AskStatistics • • Sep 15 '24

How can i visualize this using code?

Post image
3 Upvotes

13 comments sorted by

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.

1

u/Leather-Produce5153 Sep 16 '24

generate a sample and plot the density, pretty much gives you all you need.

1

u/[deleted] Sep 15 '24

Try the new gpt model. Might be good at this sort of thing

-2

u/CowboyKm Sep 15 '24

You can use Markdown

-7

u/Alternative-Dare4690 Sep 15 '24

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

2

u/CowboyKm Sep 15 '24

Check the examples here.

https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/writing-mathematical-expressions

Where do you want to depict those? If you use python (notebooks) you can open a Markdown cell.

If you use R with R studio you can do something similar afaik

-2

u/Speakop Sep 15 '24

I would use R markdown

-2

u/Alternative-Dare4690 Sep 15 '24

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