oldoc63 / learningDS

Learning DS with Codecademy and Books
0 stars 0 forks source link

Spread of a Poisson Distribution #428

Open oldoc63 opened 1 year ago

oldoc63 commented 1 year ago

Probability distributions also have calculable variances. Variances are a way of measuring the spread or dispersion of values and probabilities in the distribution. For the Poisson distribution, the variance is simply the value of lambda, meaning that the expected value and variance are equivalent in Poisson distributions.

We know that the Poisson distribution has a discrete random variable and must be greater than 0 (think, a salesperson cannot have less than 0 sales, a shop cannot have fewer than 0 customers), so as the expected value increases, the number of possible values the distribution can take on would also increase.

The first plot below shows a Poisson distribution with lambda equal to three, and the second plot shows a Poisson distribution with lambda equal to fifteen. Notice that in the second plot, the spread of the distribution increases. Also, take note that the height of the bars in the second bar decrease since there are more possible values in the distribution.

https://www.evernote.com/shard/s468/sh/4097c559-ef59-46f5-9fa1-b5c66d38b0f1/bc8dda0c9c15abaa431b921513ec70a4

oldoc63 commented 1 year ago

As we can see, as the parameter lambda increases, the variance -or spread- of possible values increases as well. We can calculate the variance of a sample using the numpy.var() method:

oldoc63 commented 1 year ago

Because this is calculated from a sample, it is possible that the variance might not equal EXACTLY lambda. However, we do expect it to be relatively close when the sample size is large.

oldoc63 commented 1 year ago

Another way to view the increase in possible values is to take the range of a sample (the minimum and maximum values in a set).

If we increase the value of lambda to 10, min and max change: