Home   About us   Mathematical Epidemiology   Rweb   EPITools   Statistics Notes   Web Design   Contact us   Links
> Home > Statistics Notes > Probability > Expectation Values, ctd.

Expectation values of a squared binomial

     Now in this section we're going to take a step back and do a bit of background work. These things are designed to help you understand better the concept of variance.      Remember that to calculate the expectation of a random variable itself (we're sticking to discrete random variables like the binomial and the geometric), we took all the possible values of the random variable x and multiplied each by the probability of occurrence P(X=x). This is the probability that the random variable X takes the particular value x. The little x represents various particular constant values that we may be interested in; if we set x=0, then we can calculate P(X=0), which is the chance that the random variable X will take the value 0. Once we have calculated all the products xP(X=x), we sum them all, and we find the expectation value. So for instance, we could compute the expectation of a binomial with say N=3 and p=0.6 this way:
Value (x) P(X=x) xP(X=x)
0 1 × 0.43 0
1 3 × 0.42 × 0.6 0.288
2 3 × 0.4 × 0.62 0.864
3 1 × 0.63 0.648

So the total is 0.288+0.864+0.648=1.8, which in fact equals 3*0.6 as advertised. The expectation value of a binomial random variable with N trials and success probability p per trial is N*p.
     Where did the factors 1 and 3 that we were multiplying by in the probability column come from? They came from the binomial formula; remember the expression involving factorials out in front?
     So you can compute the expectation value of some random quantity by (1) taking each quantity and multiplying it by the chance it would ever occur, and (2) adding this up for all the possible values. This is analogous to an average of the values in a particular data set, except that for computing the average of a particular data set you can take all the values that happen to occur and multiply them by their observed relative frequency (as we discussed in a previous page). The point of all that? The sample mean and the expectation value are both useful quantities and have a close relationship, but they are distinct. One possible problem is that if there are infinitely many possible values you might not actually be able to add all those values up in any meaningful way. So maybe the expectation value doesn't even exist. But you can always calculate a sample mean.
     But what if we wanted to compute the expectation value of some other quantity derived from a random variable? In particular we will be interested in the square of a binomial. We used earlier binomial with N=3 and p=0.6. We found that the square of such a binomial takes values {0,1,4,9} and we were able to find the probability that any of these values would appear.
     The square of this binomial is a random quantity in its own right, with its own probability function. We found out what it was on an earlier page. The way to compute the expectation is the same: take each possible value, multiply it by its probability of occurrence, and add it all together. So for the expectation of a square, we could write this by saying that the square (which we will call Y) takes values in {0,1,4,9} (in this example). We will need to calculate 0P(Y=0)+1P(Y=1)+4P(Y=4)+9P(Y=9). But we know from the earlier page where to get those probabilities for Y; they can be found from the distribution of X. Since Y=9 when and only when X=3, Y=0 when and only when X=0 and so forth, we have the expectation value of Y equal to 0P(X=0)+1P(X=1)+4P(X=2)+9P(X=3). We are still multiplying by the same values 0,1,4,9; nothing has changed. This is still the expectation value of Y. It's OK that it has probabilities that X takes certain values, because these probabilities actually haven't changed in value. The point is that to compute the expectation of Y, we need the probabilities that Y will take on particular values; because Y is the square of X, the probability that Y will take some value is found from the probability that X will take some other value. Here is a table to summarize; try to fill in the numbers which belong where there are question marks. Remember column three is the product of columns one and two. When you fill out column three, then add up all the numbers in it to get the expectation value. The first column lists all the values of Y. The second column lists the probability that each of those values will occur. The third column is the product of these two - remember to get the expectation value of any random quantity, we list all the values that can occur, multiply by the probability of occurrence, and add it all together. (By the way where to those multiplications by 3 come from in the second column? They come from the binomial distribution - remember that to get the probability that Y=4 say we need the probability that X=2; but the probability that there would be 2 successes in 3 independent Bernoulli trials is "3 choose 2" times those probability factors.
Value (y=x2) P(Y=y=x2)=P(X=x) yP(Y=y)=x2P(X=x)
0 1 × 0.43 ?
1 3 × 0.42 × 0.6 ?
4 3 × 0.4 × 0.62 ?
9 1 × 0.63 ?

Here, the total is 0.288+1.728+1.944=3.96. For the binomial with N=3 and p=0.6, this is the expected value of the square. Try this on the computer:
> z1 <- rbinom(25000,size=3,prob=0.6)
> z1sq <- z1*z1
> mean(z1sq)
This should be fairly close to 3.96. The average of a lot of squared values should be close to the expectation value of the square. By the way, the expectation value of the square of a random quantity is called the second moment.
On to even more about expectation values.

Return to statistics page.
Return to probability page.
Return to stochastic seminar.

All content © 2000 Mathepi.Com (except R and Rweb).
About us.