0:00

Hi. My name is Brian Caffo.

Â I'm in the department of Biostatistics of the Johns Hopkins Bloomberg School of

Â Public Health. And this is Mathematical Biostatistics

Â Boot Camp Lecture Three on Expectations. Expected values are ways of summarizing

Â probability distribution in the same way, in the last lecture, we talked about

Â quantiles to summarize probability distributions.

Â So, we will talk about the rules that expected values have to follow, we will

Â talk about the basic mechanics of how you calculate expected values for discrete

Â random variables and continuous random variables.

Â We will talk about important subclasses of expected values.

Â The mean, variances, and we'll talk about how to interpret variances because they're

Â a little bit trickier with Chebyshev's inequality.

Â The expected value or mean of a random variable is the center of it's

Â distribution. It's in essence a particular definition of

Â the middle of a distribution. There's more than one definition of the

Â middle of a distribution. For example, the median would constitute a

Â different definition of the middle of a distribution.

Â But the mean is a particular one. And we'll talk about the intuition behind

Â it in a minute. And consider how you would calculate the

Â mean for example, a discreet random vaiable.

Â We denote the mean with this capital E here which stands for expected value, and

Â then usually, for whatever the reason, we tend to use square brackets for expected

Â values rather than parentheses. And so, we might write expected value of

Â X. Here again, we're using a capital X

Â because we're talking about a conceptual value of the random variable.

Â This, in the case of a discrete random variable is the sum over all possible

Â values that X can take of x p(x). Now, note here.

Â If we didn't have this x out in front of the p(x), this would just sum to one

Â because the PMF sums to one by the definition of, of a PMF.

Â So, this x out in front is what turns it into an expected value.

Â Here, we were just talking about the expected value of x.

Â But if we wanted the expected value of x squared it would be the sum over x and we

Â would have a little square in front of the x right here that we're summing over.

Â So, sum over x^ two times p(x). E(X), one way to think about expected

Â value of X is that it represents the center of mass.

Â If the Xs are locations, and the p of xs are weights, and I have kind of a

Â schematic here on the next slide that's shows an example.

Â So, imagine if on the horizontal lines here, let's suppose the left most line is

Â at the point zero, and it's just a, a real line extending in the positive direction

Â and each location of, of a line here is the value that x would take.

Â So, in this case, X takes four possible values.

Â Two low values and two high values. And the height of the bars is p(x).

Â So, in this case, p(x) is equal for each of the four bars.

Â So, because p(x) is a probability mass function, each of these four bars would

Â have to take value one quarter. So, the expected value then would be the

Â center of this distribution, the point at which you would balance this out if this

Â was, say, for example, four little bars and you wanted put your finger on the

Â horizontal bars, so that it would balance out.

Â And here, of course, because the bars of the same height, you know, of two on the

Â left side and two on the right side, placed in the same configuration, the

Â geometric center of mass would be right in the middle.

Â Well, what would happen consider the one next to the right, what would happen if

Â you had three all squashed up on the right-hand side and one really far on the

Â left hand side? Well, the one really far on the left-hand

Â side would pull the mean away from the center of the three just to a little bit

Â outside of it. And then, I go through two other cases

Â over here where I vary the heights of the bars and their configuration.

Â In each of these cases, the fulcrum point at the bottom is exactly where you'd have

Â to put it to balance out the bars. And that's where the expectation gets its

Â definition from. It actually draws exactly from the

Â Physics' definition of center of mass. And, and in this case, it's exactly just

Â another property of a probability mass function in order to characterize it.

Â Let's talk about how you calculate the expected value for a coin flip.

Â So, in a coin flip, our sample space is heads or tails.

Â And we'll define our random variable as being zero for tails and one for heads.

Â Let's calculate the expected value for the probability mass function from a fair

Â coin. That is, it's a 50 percent chance of tails

Â and 50 percent chance of heads. So, let's plug directly into the formula.

Â The expected value of the coin flip x is 50%, 0.5 probability of a tail times the

Â value we've assigned for a tail, zero plus 0.5 times the value we've assigned for a

Â head, one. Add those up and you get 0.5.

Â So, the expected value of a coin flip is 0.5.

Â This exactly makes sense if you think back to our previous page.

Â If you had a bar at zero and a bar at one, and they were both equal height, you would

Â put your right at the 0.5 to balance out that bar.

Â So, it, it maps intuition. Also note the expected value does not have

Â to be a value that the random variable can take.

Â In this case, the random variable can only take value 0,1.

Â But the expected value is point 0.5 which is between the two.

Â 5:48

Okay, let's go through the same exercise but, now instead of a coin, let's talk

Â about a die. Here, the possible values that the die can

Â take are one, two, three, four, five, and six.

Â We're going to assume that the die is fair so all of the numbers have probability

Â one-sixth of occurring. What's the expected value of that die

Â roll? So, we denote the expected value again by

Â E[X]. Here we have one times the probability of

Â getting a one one-sixth plus two times the probability of getting a two one-sixth,

Â and so on. And if you add them all up, you get 3.5.

Â Again, this makes perfect sense. You have six bars of equal height.

Â One at position one, one at position two, one at position three, one at position

Â four, one at position five, and one at position six.

Â And, of course, if you were to balance that out with your finger, you'd pit it

Â right in the middle of those numbers as 3.5.

Â That covers discreet random variables, at least two examples of discreet random

Â variables. Let's talk about how you do continuous

Â random variables. Well, again, the definition follows

Â exactly from the physical definition of center of mass and in this case, the

Â expected value of a random variable x is the integral from minus infinity to

Â positive infinity of t f(t) dt. And here t, is just the dummy variable of

Â integration. Pretty much the same formula.

Â Here, if you omit this value t right here, then the integral just works out to be

Â just one again because f is a probability density function.

Â So, it's putting the t there that turns it into expected value.

Â If you wanted the expected value of x^2, then it would be integral minus infinity

Â to plus infinity t^2 f(t) dt. And this just borrows from the definition

Â of center of mass for continuous bodies rather than the center of mass of a group

Â of discreet bodies exactly from physics. And again, it's just a description or it's

Â a useful summary of the density function f which is a complicated functional

Â construct. It reduces it down to one number, which is

Â a property, which is what we kind of think as some, at least one of the definitions

Â of the center of the density f. Let's go through an example of calculating

Â the expected value of a particular kind of random variable, one that we have not

Â encountered before. So, let's think of a very simple density.

Â The density is such that it's zero below zero, constant at the value of one between

Â zero and one, and it's zero above the value one.

Â So, let's mentally just real quick verify that this is in fact a valid density.

Â Well, this density is exactly a brick. Starting at zero, ending at one, with

Â height one. You don't even need Calculus to verify

Â that this integrates to one, because it's just a square.

Â Its area is the, the length of base, which is one, times the length of the height

Â which is one. One times one is one.

Â So, it's a proper density. It's also positive everywhere because it's

Â zero below zero, zero above one, and the value one between zero and one.

Â So, it's positive everywhere. So, it's a valid density.

Â This is in fact, actually, an extremely important density.

Â It's pretty simple one, but it's an extremely important density, and it's

Â called the standard uniform density. It sort of represents the idea that any

Â value between zero and one, is equally likely.

Â It's, so imagine if you were to, to drop a pencil on a line between zero and one.

Â And you were dropping that pencil in such a way that it was equally probable to land

Â anywhere between zero and one, this density would represent that process.

Â Well, let's go ahead and calculate its expected value.

Â Now again, we already know what the answer is from the geometric argument.

Â It's a brick that starts at zero and ends at one.

Â The answer has to be 0.5 because if you wanted to balance that brick out, you

Â would have to put your finger right in the middle.

Â So, let's just verify that calculation. Here, our expected value of our uniform

Â random variable X is the integral from zero to one.

Â And again we have X, right, in the previous slide I had t, but let's just use

Â x in this slide times the density, which in this case, is just the constant one, so

Â I just didn't write it down, then dx, the variable of integration.

Â And so that integral is x^2 / two, evaluated the bound zero to one, which

Â works out to be one half, exactly what we would have thought.

Â Incidentally, I just want to remind everyone of this notation.

Â The capital X in the expected value represents a conceptual value of the

Â random variable. Whereas, the little x, in this equation,

Â represents the dummy variable of integration.

Â A value that's actually getting numbers plugged into it.

Â So, it wouldn't have mattered for this little x if we had used x, or t, or z, or

Â w, or whatever. However, it's important that we kept it at

Â capital X. That's what we've assigned this random

Â variable, the value capital X. So, it's small point but keep that in

Â mind. So, I wanted to talk about something that

Â always comes up in my in-person classes when I talk about this.

Â So, here we calculate the expected value of x.

Â And I, told you that expected value of x squared, well, you would just calculate

Â integral from zero to one, x^2 dx. And a question that always comes up in

Â class is, well, wait a minute. I could calculate expected value of x

Â squared that way or I could figure out what the distribution of the square of a

Â uniform actually is, right? A uniform random variable is a random

Â variable representing some process. So, the square of that has to be a random

Â variable and it, itself must have a density.

Â So, I should be able to calculate the expected value from that density and it

Â should be the expected value of y, let's say if y is x^2, do I get a different

Â answer if I figure out what the density associated with the square of a uniform

Â random variable is? Do I get a different answer if I calculate

Â the expected value that way? Or if I calculate the expected value this

Â way, by just putting a square into the expected value calculation from the

Â original uniform density? At any rate, you'll be happy to know that

Â you get exactly the same answer. And in fact, I would also add that it's a

Â lot easier to just put the square in this integral equation because we automatically

Â know, off the top of our head, what the density of a uniform random variable is.

Â We may or may not know what the square of a uniform random variable is.

Â So, this should give you some basic examples of calculating discrete and

Â continuous expected values. In the problems, you'll have both harder

Â and easier examples to work out, and in the assessment we'll have harder ones.

Â In the next section, we'll talk about rules that expected values have to take.

Â