Transcript for:
Jan 5 Pt 5 - Overview of Random Variables and Distributions

Bernoulli random variable was a random variable that has one parameter p for probability of success It takes 1 with probability p and 0 with probability 1-p What is the expectation of x? If you play lottery and there is a 10% chance you win In expectation, this is 10% So you write, this is 1 with probability p and 0 with probability 1-p Now the expectation is 10% chance to win. How about the variance? The variance was expected x squared minus p of x which is p squared.

What is expected x squared? How we calculate? This is 1 squared, equal to 80p, 0 squared equal to 81 minus p.

That's 0 squared equal to 81 minus p. Then we see it again. This is 1 with the probability p and 0 with the probability 1 minus p.

So expected x square is p. We have p minus p square. So this is written e times 1 minus p. We don't need to do all this calculation, we can just use the formula. Each time you have Bernoulli, the expectation is p, and variance is e times 1 minus p.

So if you have to play a game, 10% chance to win, then expectation is 10%, and variance is... 10% times 90% which is 9% so the variance will be calculated by p times 1 minus p p is 10% and your variance is going to be 10% times 90% open binomial This is binomial with parameters n and p. There are two parameters n. You play n times the game.

Each time you win with 480p. So binomial and p is there. Number of success is here.

What is the expectation? Binomial. You can write it as the sum of independent Bernoulli random wire box. So you have to play it n times each time. you win with probability, this is 1 with probability p, this is Bernoulli with parameter p, and 0 with probability 1-p The binomial is the same as summing up n independent Bernoulli random variables with parameter p What is expected of each cell?

See? You have x1 Each one is p, so you have n times p So if you have binomial, that's it You play a game, throwing a dart You play 100 times, each time you win with 20-10% In average, how many games you win? See? 10. You play 100 times, each time you win 40-10%.

In average, you win 10 games. How about the variance? We saw that when we have independent random variable, the variance of sum is...

The sum of variance symptoms. This is the same as variance of x1, variance of xn. Variance of x1 is, perinodally, with parameter p. This is p times 1 minus p. p times 1 minus p then the variance of Bernoulli binomial is p times 1 minus p but you have n after So you can use this formula for the variance of binomial. So if you have binomial with parameter n and p, the expectation is n times p, variance of n times p times 1 ms p.

So you play this game 100 times, this time you win with 80% percent. What is the variance of x? This is 100 times 10% times 20% Which is?

9 The variance is? 9 The expectation is 10 and the variance is? 9 That's it. Okay, so you don't need to waste this time.

You don't mind, you know, you can use this formula. Yeah. And for geometry, you can also calculate. I'm not going to use the movie. So, for the expectation, you can wait.

Let's consider Geometric with Parameter P. If you want to play the same game, each time you win you win by 80% until the first success. You want to see in average how many games you have to play for the first success. What do you think of the number? Each time you win with 280 10% Let's see how many games you need to play to win for the first time The formula was, remember, 280 and you need k games You have to win the first k-1 game And then you win at k The formula for p times 1-p to the k-1 What is the expected value of x? How we calculate that?

Remember, we have to sum over all k. The gap could go from 1 to infinity. It could be first k, 2k, second k, up to infinity. Average, you have to multiply k by the probability that you are at k.

How to find average is to say I'm going to be at 1 with probability 10%, I'm going to be at 2 with probability 10% times 90%, etc. So you have to sum all these numbers. G's sum of kp times 1 minus p to the k minus 1. Right? If I ask you what is this sum, each time you multiply by 2, you know, this is the 1 half plus 1 fourth plus 1 eighth plus 1 over 16. What would be this sound? This is?

Again, it goes to... Let's say this is 0, this is 1, so you are here at 1 half, then you add another 0.43, you go to the half of the remaining interval, then you go to the half of the next one, half of the next one, half of the next one, half of the next one. There is going to be 1 in there, so you go to infinity, it goes to be 1. If you do...

1 plus x plus x squared x is more than 1 this would be ok, let me show you the third way okay what is this when you multiply by 1 minus x by 1 plus x plus x squared up to x at the end what will you get When you multiply 1 with 1, you get 1 plus x up to x to the n. You multiply minus x, what do you get? You get minus x, minus x squared, minus x to the n, minus, what is the last one?

x to the n. n plus 1 everything cancel except 1 minus x to the n plus 1 correct then if you want to find this sum is 1 minus x to the n plus 1 over 1 minus 6 okay When x is 1 half, you take 1 plus 1 half, let's say n is very large, 1 fourth, 1 eighth, the answer would be, let's say you take n goes to... infinity and this one goes to 0 and you just have 1 over 1 minus X which is 1 half which will be 2. This will be 2. This 1 over 1 minus 1 half, this is 2. So if you have, if you have That's good. If I have to write 1 plus p, that's p squared, up to infinity, it would be 1 over 1 raised to the power of p.

If I have 1 plus 1 minus p plus 1 minus p squared of the infinity, this would be 1 over 1 minus 1 minus p, which is 1 over p. Does that make sense? This one is this one, when n goes to infinity, you sum up to up to infinity When x is 1 half, you have 1 over 1 minus 1 half which is 1 2 When p is 1 third, you... get 1 over 1 minus 1 third which is 1 over 2 third or 3 over 2, 1.5. So 1 plus 1 minus p plus 1 minus p squared if you sum up all the way is 1 over p.

We don't need to show. I just want to calculate the expected value of x when it is your metric. You can just use the formula. Okay?

So what is the sum? Is it going to be 1 over p? Why? I have k here.

Okay, then? Okay. Isn't that easy?

It shows that this is true. Yeah, so that's my thing, why is this true? So, if I write 1 plus 1 minus p plus 1 minus p squared plus everything, 1 minus p to the k, etc.

I will find 1 over p. Now you have to differentiate this number. OK?

What do you find? Can you differentiate? This one is 0. This one is? Negative 1. The next one is?

negative two times one minus p sorry okay so you can show that this is this one don't correct but this is exactly the sum that you said this is negative sum of k 1 minus p to the k minus 1 okay And using this, on the right hand side, when you differentiate that one, it's negative 1 over p squared. You can put plus, you can show that this is this one. And when you multiply by p, both sides.

I want to correct by p, here is the pump p, this will cancel and you get 1 over p. Alright, so I let you to check but you don't need to check. So the expectation is 1 over p, each time we have geometry, the expectation is 1 over p, we could use it.

We don't have to write all this. geometric sum. Don't worry, you get it.

But you could show that this is 1 over p, right? So the expectation, if you play a game, the chance is 10% to win. In average, you need to wait 10 games to win for the first time. This is 1 over p.

And the variance is going to be this one this time, 1 over minus p. So the same way, if you differentiate second time, you can calculate. what is expected x squared, which is k squared here. And at the end, you have a formula that you could use the variances, 1 minus p over p squared.

The variance of x is 1 minus p over p squared. So for a well-known distribution, we know what our expectation and variance. And we don't need to calculate anything. We just use the formula.

And the last one is Poisson distribution. So when x was binomial, n and p, we saw that expected of x is... n times p and variance was? n times p n times p times 1 minus p now we say that when n is large and p is small and you define your lambda n times p then x is going to be n times p When I write this notation, using the distribution, it's this one. The distribution is this one.

This notation I use for distribution. You can use whatever you like. This is Boasan with parameter lambda, which is n times p. Which was this formula.

dmm plus into the negative lambda over lambda to the k over k factorial I'm not going to show the formula for the expected affix but you can guess what will be expected affix It's similar to binomial So when the wasp enzyme is big, here it will be lambda. Yep, this lambda is going to be the average of wasp. If you use this PMF, you multiply by k, you sum up, you can show that this is going to be lambda.

Then you can sum, and you have to do similar geometry, differentiate, not show it, but we're not going to do. Yep, you can show this is lambda. What do you think it will be, Varens?

This n times p times 1 minus p. What was n times p? Nanda. Nanda. What is 1 minus p?

1p is small. p is very small. It's just 1. p is very small. So, n times p times 1 minus p, this one is the lambda, this constant, when you multiply it by 1 minus a very small number, it's just 1. So, that's a nice thing, the expectation of Poisson is lambda, its variance is also lambda. So, the expectation and variance are both lambda for Poisson distribution.

Because, by Ramiot, you see the variance. The expectation is n times p, which is constant lambda. This one is lambda 2. p is very small.

You can look at Poisson like when n is very large and p is very small. When n is very large and p is small, but the average remains constant, lambda, this guy will be similar to lambda. Any questions? Okay, so that's our discrete random variable. Now we study three continuous random variables also, which are well known.

One that we already did example with is uniform. When you pick a point uniformly at random. So we say x is uniform. There are two parameters for uniform. This continues random by one.

There is one is a, so you pick a point between a and b. We did an example, a was 0 and b was 2. We were picking a point between 0 and 2. Remember, you have xy uniform between 0 and 2. A was 0 and B was 2. Remember, what was the density for this example? This is the density function.

This is uniform, that means that the density is the same for all points between 0 and 2 after this is 0 and before also it is 0. This is only between 0 and 2, it takes some value. And what was this number? 1 half.

Why it was 1 half? Because this area you want it to be 1. So this is 1 half. You can guess what will be the density for uniform between A and B.

this should be for X between A and B so again this is continuous random variable it doesn't matter if you include A or B inside at the end the probability you are exactly at A or exactly at B is 0 when you pick a point, you are exactly at 0 or exactly at 2 is 0 so you can write as you wish for continuous random variable you can include here or you can include outside this is otherwise, if it's not between 0 and 2 the density is 0 what is between A and B, the density? if it's 0, 2, this is 1 half, if this is A and B, this is? 1 over b minus 8. You see it?

Here, this is b minus 8. You want the whole area to be 1. So, you take 1 over b minus 8. You multiply, this will be 1. a is 0, this will be 1 half, this is 1 over b minus x. So the area is the density for uniform between a and b is 1 over b minus x, for all x between a and b. So each time you know uniform, you know exactly what is density.

And you know also the CDF of uniform So, we could use for uniform the formula without calculating the result And the CDF is known also The CDF tells you what is the chance your random variable is smaller than or equal to any point If x is smaller than a, the chance is? What is the chance you are before a? 0 If x is larger than b, the chance is? 1 So if you are after b, the chance should be all area, which is 1 How about between a and b? If x is between a and b, let's say it's here, this is your x, what is the chance that you are here?

This would be this area. You have to integrate density from a to x, which is this area. The chance you are smaller than x is x minus a multiplied by 1 over b minus a.

Okay, right? x-a over b-a right so this will be this so for uniform you can use this CTF without writing yourself this is null, this is random for uniform, the CTF it looks like this rho e t, your b4x is the space area, which is x minus a multiplied by 1 over b minus a which is x minus a divided by b minus a. For uniform 0,2 a was 0, b was 2, it was just, we did the example, it was x over 2. For uniform 0, 2, the CDF was x divided by 2. So for uniform between a and b, the CDF is this one.

You can use the formula and you have the CDF. Any questions? Right here.

There is a formula for expected of x and variance of x that we are going to show what would be the expectation and variance what do you think would be expectation? If you pick a point between 0 and 2, what is the expectation or average? 1. 1. The average would be exactly the middle point here. So, what do you think the expectation would be here? What is your guess?

  1. 8? What was it? b minus a?

b minus a over 2 What is this middle point here? If let's say 1 and 3 What would be middle point? 2 If we say 3 minus 1 over 2 it would be 1 The middle point is? 1 plus 3 over 2 You see? Expected of this is?

So we are going to show that this is a plus b over 2. So you can use this formula to tell uniform a, b expectation is a plus b over 2. How do we do? Show that. You don't need to show, you just use the formula, but I want to use it for you.

So, the formula is this one for expectation. You have to multiply x to get the d. The PDF is 0 if you are not between A and B. So we have to integrate from A to B.

From A to B, the PDF is 1 over B minus A. The PDF is 1 over B minus A. You can put outside, this is a constant, 1 over B minus A. You can take off from A to B. You have X here.

You have X, C, X. What is the integral of x? x Remember the integral of x is x square over 2 This is x square over 2 1 over b minus a and you have x square over 2 and you have to vary from a to b We divide it from x equal to a to x equal to b. Which would be 1 over b minus a multiplied by, this is over 2, we would have b squared minus a squared. So you can use e square minus a square is b minus a multiplied by b plus a. So, this 2 will cancel and it will give you b plus a or a plus b over 2. The array is going to be a plus b over 2. And the expected of x is going to be a plus b over 2. Right here, so anytime you have uniform, you don't need to integrate, you can just use the formula expected of uniform is a plus b over 2. If you pick a point between 0 and 100, the average is 50. That's your middle point between 0 and 100, 50. How about the variance?

more complex but let's write it and then we can just use the formula okay so if instead of for variance we need to calculate expected x squared so here you have x squared here is the same thing but here is x squared what is the integral of x squared x3 over three so you will get b3 minus a3 over 3 times b minus a right? that is expected x squared the variance It's going to be this one minus expected of x squared which was a plus b over 2 squared. Correct?

This one is B3 minus A3 over B minus A is Do you remember? I can show This is B squared plus A squared plus A times B Right? b minus we have this uh b minus a once you apply it by this it will gives you exactly b cube minus a cube and this one is a square plus b square plus two times a times b over four Okay, hopefully we have the correct answer. This is 12. You have 4 times a squared plus b squared minus 3 times a squared plus b squared.

So you have only 1 a squared, 1 b squared. Then you have 4 times a b minus... 3 times 2 times ab, 6 times ab is minus 2 times ab over 12 which is b minus a squared over 12 okay you don't need to show you can just use the formula for uniform Calculated after.

Expectation is a plus b over 2, and the variance is b minus a squared over 12. If you pick a point between uniform 50 and 2, the average is 1, and the variance is 2 squared over 12, which is... 4 over 12, 1 third. So 4 uniform between a and b.

We have written all the integrals. You know what is average and what is biased. We can just use the formula.

You know its expectation and what is biased. Any questions about uniform? Right here? Give me an example, right here.

Good. So let's say if you, for example, model the waiting time for next, for finishing this lecture is uniform between 30 and 50. What is the expectation? This is? This is 1530 over 2 Alright, we finish in 40 minutes Late? Maybe earlier The variance of x is...

What's that? 50 minus 30 squared over 12. 50... 400...

over 12... 4... 33.3 33.3 Step by step Okay Usually uniform is not very good model for writing tag So the model we use is Exponential, the waiting time usually is modeled as exponential distribution because this is memoryless. We want usually for waiting time a model which is memoryless.

Probably it's good for the class. The way that property was, if you want to see what's the time tag, you're going to be here at least 50 more minutes. You want that?

Okay, this is for 10 minutes ago. So, we said 10 minutes ago, we wanted to know what's the chance that we're going to wait here at least 50 minutes. Given that, we didn't finish this. So, now, yeah, for 10 minutes.

If this is memoryless, it would be the same as x larger than 40. So, we have to wait another 40 minutes. So, memoryless means that. So we will deal with exponential which is memory left.

Exponential has one parameter. It is very useful. It must be used after normal distribution.

Okay, so... okay so we say that x is exponential there is one parameter for exponential that's lambda and this is characterized by its pdf the exponential distribution is characterized by its pdf the PDF is the PDF of exponential, this is usually for waiting time and it's only for positive number it's not negative, it's for waiting time so you cannot have negative rating you cannot, yeah so, in the past ok we can update the class in the past, so it's waiting time This is positive, and this is lambda, e to the nth negative lambda x. Let's see if we have exponential. For example, if you have exponential with parameter 2. Again, the pdf is two times e to the negative 3. You can check that this is a valid pdf.

That means that if you integrate over all values from 0 to infinity, this should be equal to... What? 1. 1. It should be equal to 1. So the integral of e to the negative 2x is, remember, what was it? The exponential.

The integral was, so the exponential, the integral of e to the alpha x, if you check, you have, it was 1 over alpha, the same thing. If you add alpha x, this is 1 over alpha into the alpha x. So here is... Negative 1 to the z, you have to do e to the negative 2x divided by negative 2. These two will cancel each other and you just have negative, you have negative e to the negative 2x.

You vary from 0 to infinity. This is the integral from 0 to infinity. What is the value at infinity?

At infinity this is? 0. Exponential of negative infinity is 0. What is the value at 0? negative 1, negative 1, so this is minus negative 1 and it will be exactly plus 1 so the integral, the whole integral is 1, this is valid pd action, so the whole integral is 1 this is just to check for you, otherwise you don't need the integral so we can use this one to check that this is valid pd action and if you want to find and if you want to find what is the cdf You have to do the same calculation, but this time instead of infinity, you want to see what's the chance you are smaller than x. This time, instead of infinity, you go up to x. Let me see what's the chance you are smaller than x.

So, you go to x, what do you find? And x will be negative e to the negative 2x. So you can show that this is 1 minus e to the negative 2x. So the CDF of exponential is 1 minus e to the negative lambda e to the negative lambda. So we can just use the formula without integrating.

The CDF, the probability that you are exponential at any point is 1 minus e to the negative lambda e to the negative lambda. Thank you. If you are smaller than infinity, this will disappear and become 1. For any x you can calculate what's the chance you are smaller than that number.

So let's say lambda is 2. What is the chance that x is larger than 10? How do you calculate? You have exponential with parameter 2. You ask, you calculate, what is the chance that x is larger than 10? If you don't want to integrate, you're going to use the CDF function here. You don't want to write the whole integral, because if you want to write the integral, you have to integrate from 10 to infinity of CDF, of the PDF.

Just 2 times into the negative 2 times x, b. But you don't like integral, so you're not going to write that, and you just use the formula here. And how we do? The CDF tells you what is the chance you are smaller than that.

This one we can write. This is 1 minus the chance that you are smaller than 10. Which is CDF at 10. This is CDF at 10. You can use the formula for CDF at 10. Which is 1 minus Negative. What is lambda times x?

  1. 1 minus into the negative 20, which would be like that. Multiply. 1 minus 1 plus into the negative 20. Cancel.

This is into the negative 20. That make sense? The probability x is larger than 10 is equal to negative 20 What is the probability x is larger than? 40 1 minus CDFR 40 which is?

into the negative 40 times 2 which is 80 For 80 you have to write another 40 minutes is into the negative 80. And if it was less than, then you would not add the one minus. If? If it was less than. If it was less than, it was one minus that. That's the CDF function.

If this is larger, this is, that's into the negative 80. So that just changes it, it's one minus. CDF gives you the probability that you are smaller than x. And the probability is this one. Let's now calculate what is pro-80.

x is larger than 50, given that x is larger than 10. This is the intersection divided by this pro-80. What is the intersection? x is larger than 50.