The Poisson Distribution
Skills:
ML Maths Basics90%
Key Takeaways
The Poisson distribution is derived as a limiting case of the binomial distribution and is used to model the number of events occurring in a fixed interval of time or space, with key concepts including discrete random variables, binomial distribution, and probability theory, utilizing tools such as L'Hopital's rule and moment generating functions
Full Transcript
moving along in our discussion we're going to be talking about next to poisson distribution so this is another discrete random variable and i could just give you the pmf but let's go ahead and go back to the previous video on the binomial random variable and we're going to derive it from that because this is really a limiting case of that and first introduced to it you should really think of it like that so uh let's actually go right back to our previous example with the cars and the uh and the city so remember if you didn't watch the previous video the premise was there's this big city with a lot of cars and they can either be red or white now in the previous video i said that there's an equal chance of being either red or white because there's an equal number of red cars equal number of white cars now let's say that we're going to change that up a bit uh what we're going to do is if you remember we had let's say some random variable x sub b is distributive binomial np where n was the number of trials we're seeing and p is the probability of success and that's when we're going to increase our account by 1. now what we're going to do to get to poisson is we're going to take n and let it go to infinity and we're going to take p and let it go to 0 but not just arbitrarily we want the the value we're going to call it lambda equals np we want this product to stay constant so that means that uh even though n is getting really really big and this probability is getting really really small close to zero even though that's happening when you when you take the product they're still kind of averaging in a sense in that they're the magnitude of their difference is canceling out so that this product remains constant at lambda and this lambda is the same as the lambda parameter here as we'll see in just a second okay so going back to our cars example uh what we're going to see is that we're going to observe a lot of cars a huge number of cars so we're just going to assume that this is a high traffic city first of all and you're going to instead of maybe there's a traffic cam sitting there it's going to be observing cars all day long okay so it has a huge very large size of its sample and let's say p is really small so let's say instead of half and half the probability of a white car is .0001 so there's barely any white cars in the city but if we look long enough we're going to find one so now we see kind of where this is arising the need for this limiting factor because uh if we didn't send n to infinity if n was just some you know moderately small number say still 10 if p was .0001 whatever i said that small number it's pretty likely we're not going to see a white car because we're only observing 10 cars but if we send n to infinity then it's unclear if we're going to see a white car because even though the probability is small we're observing so many that you know maybe we'll see when maybe we won't so to kind of capture that information we're going to pass from this binomial into its limiting poisson and i'm going to show you and show you the process how to do that right now so let's recall the binomial pmf probability that this binomial is equal to some k remember k has to be within a 0 to n integer inclu inclusive of either bound it's going to be it's going to be n choose k it's going to be p to the k and 1 minus p to the n minus k okay and that's going to be and 0 otherwise and this is going to be if we have zero is less than or equal to k less than or equal to n k is an element of the integers okay so we had that from before now uh what we're going to keep this quantity here lambda equals np i'm going to rewrite all these p's in terms of lambda over n so here's what we're going to do we're going to take this i'm going to expand this binomial coefficient out as what it truly is okay and now we have p to the k what is p p is lambda over n so i really have lambda over n to the power k and i have 1 minus p here so this is really 1 minus lambda over n to the power n minus k okay so this is starting to get ugly and we're going to have to go through a little bit of algebra here to get through some of these things but we'll do it so um we have i'm going to rearrange these in a suggestive way that's going to be nice later on so we have here a lambda power k lambda to the k over k factorial uh okay and then we have n factorial here we have over n minus k factorial here and we have n to the k on the bottom here so this will simplify in a second and uh here this term right here we're going to split it up as i'm going to rewrite this fraction so it's not 1 minus something so i'm just going to be n minus lambda over n to the power of n and then n minus lambda over n to the power of negative k so all i've done here is i've written one minus lambda over n as n minus lambda over n and i've taken this exponent and split it up into two different factors now we just need to do a bunch of limits so we're going to be using some limit limit stuff here so this will leave alone okay this is going to be part of our final answer we'll leave that alone this let's uh let's do that right here so this is going to be notice n factorial over n minus k factorial is what that means we keep the extra terms on the top so we keep the n we keep the n minus one in fact we keep all the way to the n minus k plus one so that that is what uh this factorial has become and then on the bottom we have k ns multiplied together so n times n all the way and there's k of these okay so i'll put k and how many terms we have on the top we actually have uh this term this term this term and if you count them all up it turns out there's k of those terms as well so we really have n over n n minus one over n and minus two over n all the way to n minus k plus one over n okay and if you see what's the limit of these guys so remember if you have a limit of products you can do the product of the limits so it's really what's the limit of n over n that's one obviously so it's one and what's the limit of n minus one over n now so this one is inconsequential when n is huge so this is again one and in fact even this last one what's n minus k plus 1 over n if n goes to infinity this minus k plus 1 becomes inconsequential so this is again 1. so it turns out this whole limit right here output goes to 1. this is very good for us now another easy one to do right now would be this one because if n goes to infinity this inside part does what again this lambda becomes inconsequential because lambda is a fixed remember right here it's fixed so this n over n that becomes a one and again it's k is some constant um not a constant but we're we're going to keep k fixed during this because we're trying to do it for a fixed value of k for now so it's 1 to the power of something fixed again 1. so this is nice this goes to 1 this goes to 1. this is more unclear because it's this same same thing this inside goes to 1 with this upper this exponent goes to infinity so we it's kind of indeterminate form we're going to use l'hopital's rule um and it should it should do so here's how we're going to use it so we're going to rewrite this guy as e to the n natural log n minus lambda over n and why can i do that because e to the natural log something is just the inside part so it's really n minus lambda over n now that to the power of n which is exactly what we have here so this is justified now i'm taking the limit of this as n approaches infinity so i really want the limit of this as n approaches infinity and once i get that limit i'm going to take e to the power of that limit and that'll be my total limit okay so what's the limit of this we're going to use l'hopital's rule so we have natural log n minus lambda over n divided by 1 over n all i've done here is written this in a different form now i can use l'hopital's take the derivative of the top and bottom let me do that right now so if we take the derivative of the top we get n over n minus lambda okay and we take the derivative of the inside so that's going to give us a 1. it's going to give bottom the derivative of top minus top derivative of bottom over bottom squared all that over derivative bottom so derivative bottom is a negative 1 over n squared okay so we can do lots of cancellations here n minus n these cancel so we just have a lambda on the top here's the n here's an n squared so this n goes away one copy of the n goes away there let's clean this up a little bit so what we have is a lambda on the top this uh negative 1 over n squared will come on the top as negative lambda over n squared we have n minus lambda down here and we have another copy of n so really here's that that'll go away with this so let me flip over because this is getting a little messy so let's see what we have we have negative lambda n over n minus lambda let me write that negative lambda n over n minus lambda now it's a little bit easier to see what's the limit of this as n goes to infinity we see that this negative lambda on the bottom is inconsequential as n goes to infinity so it's really negative lambda n over n which goes to this limit is equal to negative lambda and don't forget we need to take e to the power of this guy so it's going to be e to the negative lambda so we see this guy goes to e to the negative lambda so in all what do we have lambda to the k over k factorial e to the negative lambda nice pretty clean right so e to the negative lambda lambda to the k over k factorial this is the uh pmf of the poisson distribution so let me go ahead and write that so probability and now remember here we're doing x b since we have limited this to the poisson we're going to just we're going to use x okay because we're going to take this limiting pmf as just being the pmf of our poisson lambda random variable so probability that x is equal to some k is equal to this and we're going to do 0 otherwise just a general thing in probability even if you don't know what's supposed to go here it's a good idea to put 0 otherwise because it's going to be something here so let's try to figure out what this is in the binomial case we saw that k has to be between 0 and inclusive and k has to be an integer now k still has to be an integer and so has to be between 0 and n and n is sent to infinity so really it has to be something we have to say k is an element of the set 0 1 2 dot dot which means it goes on forever because k uh n was sent to infinity so we can choose any integer that is zero or bigger okay cool so this is our actual this is our law and this is how we derived it so it's actually really nice to see how it's derived because uh you see what it truly is it's a limiting of a binomial okay otherwise if you just saw this you would it doesn't really make much sense okay so now that we have this we can do what we did in the previous videos we can find expect value variance mgf and then look at a few other things so let's find the expected value so the expected value of this guy is uh what so it's going to be the expected value of x remember what this is defined by what so this is defined as uh we need to take each value of this so zero one two so on not zero because that'll just cancel but one two every single positive uh integer multiply it by this so that seems a little daunting at first but not so bad so it's gonna be a sum from k is equal to 1 to infinity right because we can choose any and n was sent to infinity of uh we have to multiply that number times the probability of that number happening so it's e to the minus lambda lambda to the k over k factorial looks a little scary but let me show you how to work it through k equals 1 infinity this k cancels with one copy of the k down here so really what we have left here is e to the minus lambda lambda to the k over k minus 1 factorial so already it's a little bit nicer now let's take this e to the negative lambda and a copy of this lambda out front so i have lambda e to the minus lambda sum from k equals 1 to infinity and i'll put what's in the sum right below so it's going to be lambda to the k minus 1 over k minus 1 factorial now notice this k minus 1 is kind of annoying so since we started the sum at 1 we can just start it at 0 and replace this with k so this is really sum k equals uh well out front we have lambda e to the minus lambda k equals zero to infinity of lambda to the k over k factorial now this guy this sum right here is uh if you know the taylor expansion for e to the power of x this is exactly what that is except here x is lambda so we have equals lambda e to the minus lambda e to the lambda and of course these guys these two will just become combined to become one so it's really cleanly just lambda so even though it starts a little bit messy kind of becomes something very nice so the expected value of a poisson distribution uh is just the parameter lambda now let's do the variance that can get a little bit now that we have this trick it's not that bad um so let's try to do that so the variance of x remember is the expected value of the random variable x squared minus expected value of x squared this we already have we know this is lambda squared okay what is this expected value of x squared we're going to do the same thing it's going to be some k equals 1 to infinity and x squared will represent here by k squared right so it's going to be k squared e to the minus lambda lambda to the k over k factorial now we're going to see we're going to run into a little bit of a problem but it's easily resolved uh what are we going to do so we're going to start off the same way so we're going to have one of these k's will go away i will take out the beginning of this factorial so we're going to have k e to the minus lambda lambda to the k over k minus 1 factorial now notice we can't use the same trick we used up here because we have this extra k kind of just sitting here so what are we going to do let me find another piece of paper okay so what we're going to do about this um so what we're going to do is first we're going to take this e to the minus lambda and a copy of lambda out front so we're going to do lambda e to the minus lambda and we're going to what's in the sum right now it's k equals 1 till infinity of k lambda to the k minus 1 over k minus 1 factorial and now we're going to rewrite this k as k minus one plus one so we're gonna rewrite this as two sums really it's lambda e to the minus lambda uh it's gonna be the first sum will be k equals one to infinity k minus one lambda to the k minus 1 over k minus 1 factorial plus the next sum is k equals 1 till infinity of uh just one so lambda to the k minus 1 over k minus 1 factorial okay i know this might be confusing let me explain so um i started here and this constant stayed out front and now i rewrote this k as i rewrite as k equals k minus one plus one which there's no problem with that and since i did that i split this up into two sums one that had this as the beginning and one that had this as the beginning term so that's why in this term everything else is the same except this was replaced by k minus one and in this sum everything else was the same as here except i use the one and put it there i didn't write it explicitly but it's there okay so now this is much easier to do this is like we did in the previous ones so we have lambda e to the minus lambda now see this k minus 1 will go away with the first term in this factorial so that we really have and really this sum now starts at 2 because if you put 1 this is 0. so it's sum k equals 2 to the infinity and then we have lambda to the k minus 1. let me pull a lambda out front so we have 11 to the k minus 2 over and since these cancelled what we're left with down here is k minus 2 factorial okay and this is just what it is um okay this looks messy right now let's clean it all up and bring it all together okay so this this sum right here is just uh it's the same as what we had on the previous sheet actually because if you look at this previous sheet this sum that we had in the very end it was a sum lambda to the k over k factorial starting k equals zero now this is the same thing because we're starting k equals two so it's really just offset so this is again this is just e to the lambda and if you look again this is the same thing because it's offset by one instance so this is just again e to the lambda so we have e to the minus lambda e to the lambda e lambda so they all cancel just to become one so this goes away this goes away this goes away so we're left with nothing but lambda squared plus lambda and this is equal this is not the variance yet uh another thing in probability you might do super long calculations to try to find expected value of x squared don't forget that you still have to subtract expected value of x squared okay so what i mean is that we've just found this we need to subtract lambda squared and that's a good thing we do because that makes it even cleaner so this minus lambda squared gives us just lambda so the cool thing about the poisson distribution is that the mean and variance are the same and they're the parameters so they're very easy to remember and you can just state them right off the bat which is really cool okay so here we have this and last thing to find the moment the moment generating function which is not that bad so the expected value of e to the s x we're going to do the same thing we have some k equals 0 till infinity e to the s uh let's do k here um and we're going to have e to the minus lambda lambda to the k over k factorial okey-doke now let's clean this up so this is going to be uh sum k equals zero till infinity let's pull lambda to the k and this e will combine as e to the s actually what we're going to do what we're going to do is that you see that this is e to the s k and this is lambda to the k so we're going to combine this as so that we're going to combine this as let me just rewrite it again and then show that in the next step so yeah we have lambda to the k and e to the sk so we're going to rewrite this as k equals 0 till infinity lambda e to the s k okay by the rules of exponents i've just put them together and this e to the minus lambda i'll pull out front and again it's over k factorial now look at what this is uh in this previous piece of paper we had that sum from k equals 0 to infinity of lambda k over k factorial was just e to the power of lambda so it's e to the whatever is here now this is the same form but it's not lambda that's in here it's lambda e to the s so it's actually e to the minus lambda and now it's e to the power of lambda e to the s okay looks a little bit ugly so let me actually just wrap around back here and write the final statement up here so if we combine these if we put the exponents together and add them it's going to be e to the lambda e to the s minus lambda and come factoring this lambda out e to the s minus one so the moment generating function of a poisson distribution uh this position random variable is e to the lambda which is a parameter and inside the parenthesis we have e to the s minus one so be careful because this is e to the e to the something eventually up here so it's a little bit confusing but just if you keep uh if you remember where this e to the s and the minus one is not applied to the s it's applied to the e to the s okay so if you know that if you know the derivation it's easier to memorize what this guy is okay cool so um i guess the last thing we'll do is draw a quick picture of what a what a typical poisson distribution might look like so uh here we have again the same this is going to be joining the pmf so here's k here's probability that x equals k so here's the graph of the pmf so i won't put numerical values but i'll kind of say when uh when n when um when the when the parameter is small so when we have lambda uh something let's say lambda equals three the shape generally looks kind of like well where does it start we can say that when k is zero what is this when k is zero zero factorial is one lambda to the zero is one so just e to the negative lambda so it starts uh it starts at a place determined by this parameter so let's just say it starts somewhere and then it kind of it's kind of skewed okay so if we if we were to draw it it would look a little bit like that okay and each point represents a different integer uh value okay so it's a little bit skewed like that but if we have for example lambda equals 10 it becomes it looks a lot more uh like a normal distribution or like the binomial distribution we saw previously in that it kind of shifts over so it kind of let me do a different color even so i'm doing blue so lambda equals 10 in blue it kind of becomes a lot more looking like this and if you put bigger values of lambda it actually skews the other direction in that for example if you put lambda equals 100 now i shouldn't put this on the same graph as here but just to show you the behavior it kind of has this really long tail on the left and then it does the same behavior over here okay so that's interesting about this interesting thing with the poisson distribution so i actually meant to show a few more examples of uh showing that the sum of two independent poisson random variables is poisson but i think i'll do that in a next video or a side video so actually i'll make that side video click here if you want to see a few additional cool things about the poisson distribution and plus on random variables
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from ritvikmath · ritvikmath · 17 of 60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
▶
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Math Team Update
ritvikmath
Single Variable Calculus Volume of a Sphere - Proof 1
ritvikmath
Single Variable Calculus Volume of a Sphere - Proof 2
ritvikmath
Multivariable Calculus Volume of a Sphere Proof - Triple Integrals
ritvikmath
Multivariable Calculus Volume of a Sphere Proof - Double Integrals
ritvikmath
The Euclidian Algorithm
ritvikmath
Proving the Chain Rule
ritvikmath
Proving the Fundamental Theorem of Calculus Part 1
ritvikmath
Proving the Fundamental Theorem of Calculus Part 2
ritvikmath
Math Puzzle - Poison Perplexity
ritvikmath
Math Puzzle - Poison Perplexity - Solution
ritvikmath
Expected Value and Variance of Continuous Random Variables (Calculus)
ritvikmath
Expected Value and Variance of Discrete Random Variables (No Calculus)
ritvikmath
Array Method
ritvikmath
Complex Power Series and their Derivatives
ritvikmath
Distributions - Intro
ritvikmath
The Poisson Distribution
ritvikmath
The Bernoulli Distribution
ritvikmath
The Binomial Distribution
ritvikmath
The Continuous Uniform Distribution
ritvikmath
The Geometric Distribution
ritvikmath
The Triangular Distribution
ritvikmath
The Exponential Distribution
ritvikmath
The Borel Distribution + Notes on Poisson Distribution
ritvikmath
The Gamma Distribution
ritvikmath
The Normal Distribution
ritvikmath
The Laplace Distribution
ritvikmath
The Chi - Squared Distribution
ritvikmath
Overfitting
ritvikmath
Vector Norms
ritvikmath
Truths Behind the Titanic : K-Nearest Neighbor
ritvikmath
The Mathematics of Breakups
ritvikmath
Sillyfish
ritvikmath
Finding Optimal Paths - Dynamic Programming
ritvikmath
HowToDataScience : Scraping Twitter Data
ritvikmath
Decision Trees
ritvikmath
Perceptron
ritvikmath
Naive Bayes
ritvikmath
K-Nearest Neighbor
ritvikmath
Evaluating Machine Learning Models
ritvikmath
Decision Tree Pruning
ritvikmath
K-Means Clustering
ritvikmath
Gaussian Mixture Model
ritvikmath
Data Science - Fuzzy Record Matching
ritvikmath
Time Series Talk : Autocorrelation and Partial Autocorrelation
ritvikmath
Time Series Talk : Autoregressive Model
ritvikmath
Time Series Talk : Moving Average Model
ritvikmath
Time Series Talk : ARMA Model
ritvikmath
Time Series Talk : ARCH Model
ritvikmath
Time Series Talk : White Noise
ritvikmath
Time Series Talk : Stationarity
ritvikmath
Time Series Talk : ARIMA Model
ritvikmath
Time Series Talk : Lag Operator
ritvikmath
Time Series Talk : What is Seasonality ?
ritvikmath
Time Series Talk : Seasonal ARIMA Model
ritvikmath
So ... What Actually is a Matrix ? : Data Science Basics
ritvikmath
Derivative of a Matrix : Data Science Basics
ritvikmath
Basics of PCA (Principal Component Analysis) : Data Science Concepts
ritvikmath
Eigenvalues & Eigenvectors : Data Science Basics
ritvikmath
The Covariance Matrix : Data Science Basics
ritvikmath
More on: ML Maths Basics
View skill →Related Reads
📰
📰
📰
📰
while loops in Python: repetition with a condition
Dev.to · Javi Palacios
Building an Open-Source Python Projects Community: Join the Journey
Medium · Programming
Building an Open-Source Python Projects Community: Join the Journey
Medium · Python
Making fundamentals and advanced concepts very clear
Reddit r/learnprogramming
🎓
Tutor Explanation
DeepCamp AI