Moment Generating Functions

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so this is the very last part of the chapter five material that we'll be doing and it is pretty much theoretical but it's interesting and I like to teach it because you know takes us to a little bit of a deeper level and I think you might find it interesting also so this is something called the moment-generating function and it is kind of bizarre you can read the textbook about where it came from and why it's useful but well I'll just say what's useful sometimes it's easier to find the expected value of a complicated function by using this method and I'm going to just show you two examples of a moment generating function and really just why it works okay for two things that are for two distributions that are very easy to find the mean and variance of but it's a good good demonstration okay so the moment-generating function it's actually it's a function about a random variable X but we introduced this other letter T so MX of T is my moment generating function for X and this is defined to be the expected value of e to the T X now when X is discrete so I'm going to kind of use an arrow here so when X is a discrete random variable we would find the expected value of this quantity just like we would find the expected value of really anything else the expected value of something is the summation over all X of the something so e to the T X if we wanted to do that we would sum over all of my values of x and then we take e to the T packs times the probability mass function of X that's if XS discrete if X is continuous the way we would get the expected value this continuous we would use the integral over all X and we would take e to the T x times its X is probability density function and we're going to be doing one example of each one of those so here's what's interesting and we take the first derivative of my moment generating function that and I set T equal to zero and that's the point here so when T equals zero we get the expected value of x t equals zero here just in case and when we take the second derivative of the moment generating function we get the expected value of x squared well we certainly know that the expected value of x that's just equal to my population mean of X if I wanted to get my variance of my random variable X using the moment generating function well we know that that is the expected value of x squared minus the mean squared and so I would have to take this value here put it in here and then remember to take a population mean value here and put it here you have to be a little bit careful because this takes just one more step okay let me go ahead and give you an example of a discrete example so that's what's called problem 14 and I'll be coming back to this slide okay now suppose we have the face value for the thrill of a fair guy we happen to know that the probability mass function for this would be a discrete uniform random variable because each one of these face values is equally likely so one over six this is pretty easy to see we also know from our previous experience with this random variable and you can go ahead and remind yourself of how to get these but we already know ahead of time that the expected value of X which is just the mean ends up being seven halves or three point five and you should go ahead if you don't remember that you can also apply the formula here which would be a plus B over two so for a discrete uniform this a would be one and that B would be six if I'm interested in the variance of X for a discrete uniform I know that that will be being minus a plus one squared minus 1 all over 12 and when you plug that and then I'm actually going to just take that two to four decimal places because it fraction Y is it's not not the prettiest thing in the world that will end up being two point nine one six seven and let me give you just a second to go ahead and and verify that ends up being 35 twelve which is two point nine one six seven so we already know this stuff we already know this but I want to show that you get these values by using the moment generating function so first I'm going to determine the moment generating function for X ice upon this PDF PMF so we call it M X of T and that's going to be the expected value of e to the T X which I said for a discrete random variable is I'm going to sum over all my values of X e to the T X and then multiply it by the probability function for X so what does this look like all X is 1 2 3 4 5 6 so wherever I see an X here I'm just going to plug in the appropriate values so I'm gonna have a to the T X is 1 times the probability that X is equal to 1 plus to the tee times 2 times the probability X is equal to 2 and I'm going to do the whole thing here just so we don't miss anything and there will be those six terms and then e to the T times 5 times P 5 plus e to the T times 6 times P 6 well if I plug in each one of these piece P 1 2 3 up through 6 they're all 1 6 I can pull all of this together and each one of those is 1/6 and then I have e to the T times 1 plus e to the 2t which is that second term and so on plus e to the 3t plus e to the 4t plus e to the 5 T plus e to the 6 T so that's my moment generating function now check the determine the moment generating function of X let's call that part a right there okay and then use the MGF we'll call this B so to get B I want the expected value of x I mean I already know that it's 3 and a half okay but I'm going to use a moment generating function here so according to that that means that if I take the first derivative with respect to T of my moment generating function in T and then set T equal to zero I'm going to get the expected value of X so let's take the first derivative here the first derivative will be 1/6 and then it'll be e to the T plus 2 e to the 2t plus 3 e to the 3t plus 4 e to the 4t plus 2 5 e to the 5 t plus 6 e to the 6 t and then it says I have to take all of that and set t equal to 0 so my expected value of x which is my population mean if I set T equal to zero and all of this what do I get I get 1/6 e to the power 0 is 1 - e to the power 0 is 2 3 e to the power 0 is 3 and so on and when you add up all of these you get 3 6 10 you get 21 over 6 which is 7 halves which is 3.5 so check so we were able to show that the expected value of x up here which we already know from discrete applications we now showed it using the moment generating function now to get the variance of X I'm going to need the expected value of x squared and then I have to plug it into the variance formula so if I want the expected value of x squared that's going to be the second derivative of my moment generating function and then I'm going to set T equals 0 so to get the second derivative I'm really just going to take D DT of the DT MX of T so this piece right here I've already done this I've already gotten the first derivative that is everything that is right here so I don't have to redo that I've already done it now I'm just gonna take the first I'm going to take the derivative of this stuff in yellow to get the second derivative when I do that I'm gonna have 1/6 and then I'll have the first derivative of e to the T is e to the T then the first derivative of two e to the 2t will be that two comes down and that ends up being four e to the 2t then this term will be nine e to the 3t and so on then they'll have 16 e to the 4t plus 25 e to the 5t plus 36 e to the 60 so this is the second derivative of the MX of T or the first derivative of the first derivative now what I need to do is take all of that and set T equals zero and when I do that set T equal to zero and all of this I end up with 1 is 6 and then I get 1 plus 4 plus 9 plus 16 plus 25 plus 36 for all of this that ends up being 91 6 but that's not the variance I can't get the variance yet the variance of X is going to be this expected value of x squared minus the mean squared so I'm going to take 91 6 minus 3.5 squared and when I do that it's going to be two point nine one six seven and I'm going to put a little check mark there right now and this variance that we already knew from our discrete applications I use the moment-generating function to show that I get exactly that value so this works for any of the discrete probability mass function that have names or don't have names so let's do one for a continuous random variable and that will be the last problem from this from from this chapter that we're going to do so problem 15 I'm going to do an exponential one now on a quiz or an exam you could expect to be given a different probability density function or probability mass function but it says let X be the time in minutes until the first arrival to a bank that is just open for the day so I've given the probability density function here and I'm just going to leave it in terms of lambda in this case so it's determined the moment generating function of X and then use it to get the expected value and the variance so some of the things that we know about the exponential right we already know that the expected value of an exponential random variable is equal to 1 over lambda we also know that the variance of an exponential random variable is 1 over lambda square we already know that from previous experience so let's do a and B here a is determine the moment generating function of X so M X of T has the same definition whether it's discrete or continuous it's the expected value of e to the T times X but since it's a continuous random variable what we're going to do now is we're going to integrate from all x times e to the t x times f of X which is well if all X is going to be let me just write it this way let's do it this way DX so now we've punch everything in X goes from 0 to infinity e to the TX that shouldn't be underlined times lambda e to the minus lambda X DX now I'm going to gather some terms here in a convenient way because I've taught this several times you can do it kind of any other way you like it just makes the lamb but to do it makes it a little bit easier I can gather these terms so e to the T X times e to the minus lambda X can be expressed as e to the some of those exponents so I could write this as [Music] lambda moving some things around here e to the T X minus lambda X DX okay but I want to write that a little bit more convenient I'm going to write this as to get this integral x equals 0 to infinity lambda e to the minus now notice what I'm going to do minus X and then I'm going to have it as lambda minus T does that work out let me see e to the minus yep yep yep and then D X this is just going to make it a little bit easier you'll see I hope you'll see okay when I do this integral and again you might have to remember how to do these things this lambda minus T is going to be treated as a constant okay so this integral will be and I'll be very careful here get it right this integral will be as follows la lambda is a constant we know that this piece remains okay we know that we have to divide by the constant that was the exponent so that would be divided by lambda minus T and then one more thing because this is a negative exponent we have to multiply it by a minus one and that's it so now if I take the first derivative of this whole messy mess here I will get this back okay so let's make sure that that makes sense this would be if I take the first derivative with respect to X here I'm going to get lambda minus T pulled down here which will cancel out with this and then a minus one which gets pulled down which cancels out with that so everything is cool here now I just have to go from X goes from zero to infinity now I'll just write it out because we're gonna need you to remember these things eventually the top term when X is equal to infinity this is going to be a minus lambda e to basically a minus infinity lambda minus T right that's the first term all over lambda minus T and then we subtract from it when X is equal to zero so we have again a minus lambda e to the 0 times lambda minus T so now we've got em X of T grabbing everything here e to the minus infinity means this whole term is going to go to 0 so this term here oops I forgot to divide - - tea here so now we have plus a positive e to the power 0 is a 1 so my moment generating function after all of this mess ends up being a lambda over lambda minus T I'm gonna write it a little bit differently because I'm gonna have to take the derivative of it so I'm gonna write this as lambda times lambda minus T to the minus 1 so that's per a it wasn't very fun Part B says use the moment generating function to determine the expected value of X so the expected value of x is going to be my first derivative of my moment generating function with respect to t be careful with that M X of T and I'm going to set T equals to 0 so this first derivative here is easier to me to look at it this way so my first derivative will be a minus 1 times lambda times lambda minus T to the minus 2 and I'm going to set that equal to zero if I look at this it ends up oh and then there's a minus one because of the minus T in here so we get let me do it again we have minus 1 lambda lambda minus T and then times a minus 1 so then we get lambda over lambda minus T squared that's what that is evaluated at T is equal to 0 that'll be lambda over then lambda minus 0 squared equals lambda over lambda squared equals 1 over lambda well the expected value of an exponential random variable should be 1 over lambda and using the moment generating function was able to show that also part B use a different color though now I'm going to find the variance of X but that has to be the second derivative here evaluated at zero so again for Part B I need the expected value of x squared which we know is going to be d squared DT squared of this moment generating function evaluated at T is zero this is the same thing as just saying take the first derivative of the first derivative of M X of T and set it equal to T is zero and just like I did with the previous example right here where was it here it's not very pretty this right here is my first derivative of M X of T I'm going to write it a little bit differently or so now what I want is D DT of lambda lambda minus T to the minus two and then I'm going to set that equal to T is zero now taking this derivative this is going to end up being a minus 2 lambda lambda minus T to the minus three and then times a minus 1 again and again I'm not here to teach calculus so if this doesn't make sense to you I'm going to refer you back to your calculus for YouTube which is more popular or Khan Academy to write this a little bit differently this will be these ends up being a 2 lambda over lambda minus T to the third power I'm going to evaluate that at T is 0 I do that on to lambda over lambda to the third because that T is zero then that will be two over lambda squared don't panic that's the expected value of x squared it's not the variance right so to get the variance of X I need the expected value of x squared minus the mean squared so the expected value of x squared is this 2 over lambda squared minus the mean which is 1 over lambda squared and when I do that I end up with 1 over lambda squared and yay that also that's something we knew anyway so the variance of an exponential random variable 1 over lambda squared using a moment generating function 1 over lambda squared that's kind of cool it's very mathy but this technique sometimes can get you to the mean and the variance of a more complicated random variable
Info
Channel: Dr C
Views: 15,025
Rating: undefined out of 5
Keywords:
Id: wOtmFXVTJBQ
Channel Id: undefined
Length: 23min 47sec (1427 seconds)
Published: Sat Mar 14 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.