text
stringlengths
270
6.81k
f Z z for Z. (c) Compute the marginal density fW Binomial n1 2.9.12 Let X Y. Use Theorem 2.9.3(a) to prove that Z X 2.9.13 Let X and Y be independent, with X Negative­Binomial r2 Negative­Binomial r1 2.9.14 Let X and Y be independent, with X Z 2.9.15 Let X and Y be independent, with X Gamma Let Z 2.9.16 (MV) Show that when Z1 Z2 are i.i.d. N 0 1 and X Y are given by (2.7.1), then X Y 1 2 1 and Y 2 and Y Y. Use Theorem 2.9.3(b) to prove that Z Gamma. Binomial n1 and Y Negative­Binomial r1 Y. Use Theorem 2.9.3(a) to prove that Z Y. Use Theorem 2.9.3(b) to prove that Z N 2 2 2. Gamma. Let Z r2 Bivariate Normal N 1 1 Binomial n2 2 2. Let. Let Z N 1 n2.10 Simulating Probability Distributions So far, we have been concerned primarily with mathematical theory and manipulations of probabilities and random variables. However, modern high­speed computers can be used to simulate probabilities and random variables numerically. Such simulations have many applications, including: To approximate quantities that are too difficult to compute mathematically To graphically simulate complicated physical or biological systems To randomly sample from large data sets to search for errors or illegal activities, etc. To implement complicated algorithms to sharpen pictures, recognize speech, etc. To simulate intelligent behavior To encrypt data or generate passwords To solve puzzles or break codes by trying lots of random solutions To generate random choices for online quizzes, computer games, etc. Chapter 2: Random Variables and Distributions 117 Indeed, as computers become faster and more widespread, probabilistic simulations are becoming more and more common in software applications, scientific research, quality control, marketing, law enforcement, etc. In most applications of probabilistic simulation, the first step is to simulate ran­ dom variables having certain distributions. That is, a certain probability distribution will be specified, and we want to generate one or more random variables having that distribution. Now,
nearly all modern computer languages come with a pseudorandom number of random values generator, which is a device for generating a sequence U1 U2 that are approximately independent and have approximately the uniform distribution on [0 1]. Now, in fact, the Ui are usually generated from some sort of deterministic iterative procedure, which is designed to “appear” random. So the Ui are, in fact, not random, but rather pseudorandom. Nevertheless, we shall ignore any concerns about pseudorandomness and shall sim­ ply assume that U1 U2 U3 Uniform[0 1] (2.10.1) i.e., the Ui are i.i.d. Uniform[0 1] Hence, if all we ever need are Uniform[0 1] random variables, then according to (2.10.1), we are all set. However, in most applications, other kinds of randomness are also required. We therefore consider how to use the uniform random variables of (2.10.1) to generate random variables having other distributions. EXAMPLE 2.10.1 The Uniform[L R] Distribution Suppose we want to generate X can simply set Uniform[L R]. According to Exercise 2.6.1, we to ensure that X Uniform[L R]. X R L U1 L 2.10.1 Simulating Discrete Distributions We now consider the question of how to simulate from discrete distributions. EXAMPLE 2.10.2 The Bernoulli Suppose we want to generate X Distribution Bernoulli, where 0 1. We can simply set X 1 0 U1 U1 0 or X Then clearly, we always have either X P U1 because U1 Uniform[0 1]. Hence, we see that X 1. Furthermore, P X 1 Bernoulli. EXAMPLE 2.10.3 The Binomial n Suppose we want to generate Y are two natural methods for doing this. Distribution Binomial n, where 0 1 and n 1. There 118 Section 2.10: Simulating Probability Distributions First, we can simply define Y as follows: Y min U1 That is, we let Y be the largest value of j such that the sum of the binomial probabilities up to j 1 is still no more than U1. In that case U1 n k k 1 n k U1 y k 1 n k U1 and Hence, we have Y Binomial n, as
desired. Alternatively, we can set Xi 1 0 Ui Ui 1 2 3. Then, by Example 2.10.2, we have Xi for i with the Xi at the end of Example 2.3.3, if we set Y. Y for each i, independent because the Ui are independent. Hence, by the observation Xn, then we will again have Binomial n Bernoulli X1 In Example 2.10.3, the second method is more elegant and is also simpler compu­ tationally (as it does not require computing any binomial coefficients). On the other hand, the first method of Example 2.10.3 is more general, as the following theorem shows. Theorem 2.10.1 Let p be a probability function for a discrete probability distri­ bution. Let x1 0. Let U1 Uniform[0 1]. Define Y by be all the values for which p xi x2 x3 j Y min x j : p xk U1 k 1 Then Y is a discrete random variable, having probability function p. Chapter 2: Random Variables and Distributions 119 PROOF We have P Y xi xk U1 and p xk U1 i p xk U1 k 1 i p xk k 1 p xk k 1 i 1 k 1 p xk p xi Also, clearly P Y y P Y p y, as desired. y 0 if y x1 x2. Hence, for all y R1, we have EXAMPLE 2.10.4 The Geometric To simulate Y we can let U1 Uniform[0 1] and then set Geometric Distribution, we again have two choices. Using Theorem 2.10.1, Y min j : 1 k U1 min j : 1 1 j 1 U1 j k 0 min j : j log 1 U1 log 1 1 log 1 U1 log 1 where r means to round down r to the next integer value, i.e., r integer not exceeding r (sometimes called the oor of r ). Alternatively, using the definition of Geometric from Example 2.3.4, we can set is the greatest Xi 1 0 Ui Ui Uniform[0 1]), and then let Y min i : Xi 1 1 2 3 for i Either way, we have Y (where Ui Geometric, as
desired. 2.10.2 Simulating Continuous Distributions We next turn to the subject of simulating absolutely continuous distributions. In gen­ eral, this is not an easy problem. However, for certain particular continuous distribu­ tions, it is not difficult, as we now demonstrate. EXAMPLE 2.10.5 The Uniform[L R] Distribution We have already seen in Example 2.10.1 that if U1 Uniform[0 1], and we set X R L U1 L then X forward. Uniform[L R]. Thus, simulating from any uniform distribution is straight­ 120 Section 2.10: Simulating Probability Distributions EXAMPLE 2.10.6 The Exponential We have also seen, in Example 2.6.6, that if U1 Uniform[0 1], and we set Distribution Y ln 1 U1 then Y straightforward. Exponential 1. Thus, simulating from the Exponential 1 distribution is Furthermore, we know from Exercise 2.6.4 that once Y 0 and we set Exponential 1, then if Z Y ln 1 U1 then Z also straightforward. Exponential. Thus, simulating from any Exponential distribution is EXAMPLE 2.10.7 The N Simulating from the standard normal distribution, N 0 1, may appear to be more difficult. However, by Example 2.9.3, if U1 Uniform[0 1] and U2 Uniform[0 1], with U1 and U2 independent, and we set 2 Distribution X 2 log 1 U1 cos 2 U2 Y 2 log 1 U1 sin 2 U2 (2.10.2) then X using this trick, the standard normal distribution can be easily simulated as well. N 0 1 (and furthermore, X and Y are independent). So, N 0 1 and Y It then follows from Exercise 2.6.3 that, once we have X N 0 1, if we set 2. Hence, it is straightforward to sample from any X Z normal distribution. then Z N These examples illustrate that, for certain special continuous distributions, sam­ pling from them is straightforward. To provide a general method of sampling from a continuous distribution, we first state the following definition. Definition 2.10.1 Let X be a random variable, with cumulative distribution func­ tion F. Then the inverse cdf
(or quantile function) of X is the function F 1 defined by F 1 t min x : F x t for 0 t 1 In Figure 2.10.1, we have provided a plot of the inverse cdf of an N 0 1 distribu­ as as the argument goes to 0, and goes to tion. Note that this function goes to the argument goes to 1. Chapter 2: Random Variables and Distributions 121 3 2 1 0 ­1 ­2 ­3 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 Figure 2.10.1: The inverse cdf of the N 0 1 distribution. Using the inverse cdf, we obtain a general method of sampling from a continuous distribution, as follows. Theorem 2.10.2 (Inversion method for generating random variables) Let F be any Uniform[0 1]. Define a random cumulative distribution function, and let U variable Y by Y F y, i.e., Y has cumulative distribution function given by F. F 1 U Then P Y y PROOF We begin by noting that P Y smallest value x such that F x i.e., U F y. Therefore, y U. Hence, F 1 U P F 1 U y. But F 1 U is the U, y if and only if But 0 F y 1, and U Uniform[0 1], so P U F y F y. Thus It follows that F is the cdf of Y, as claimed. We note that Theorem 2.10.2 is valid for any cumulative distribution function, whether it corresponds to a continuous distribution, a discrete distribution, or a mixture of the two (as in Section 2.5.4). In fact, this was proved for discrete distributions in Theorem 2.10.1. EXAMPLE 2.10.8 Generating from an Exponential Distribution Let F be the cdf of an Exponential 1 random variable. Then F x x 0 e t dt 1 e x It then follows that F 1 t min x : F x min x : x t ln 1 min x : 1 t ln 1 e x t t ln 1 1 t 122 Section 2.10: Simulating Probability Distributions Therefore, by Theorem 2.10.2, if U Uniform[0 1], and we set Y F 1
U ln 1 1 U (2.10.3) then Y Exponential 1. ln 1 U, then Y Now, we have already seen from Example 2.6.6 that, if U Uniform[0 1], and we set Y Exponential 1. This is essentially the same as (2.10.3), except that we have replaced U by 1 U. On the other hand, this is not surprising, because we already know by Exercise 2.6.2 that, if U Uniform[0 1], then also 1 U Uniform[0 1]. EXAMPLE 2.10.9 Generating from the Standard Normal Distribution Let be the cdf of a N 0 1 random variable, as in Definition 2.5.2. Then 1 t min x : x t and there is no simpler formula for U Uniform[0 1], and we set 1 t. By Theorem 2.10.2, if Y 1 U (2.10.4) then Y N 0 1. On the other hand, due to the difficulties of computing with 1, the method of (2.10.4) is not very practical. It is far better to use the method of (2.10.2), to simulate a normal random variable. and For distributions that are too complicated to sample using the inversion method of Theorem 2.10.2, and for which no simple trick is available, it may still be possible to do sampling using Markov chain methods, which we will discuss in later chapters, or by rejection sampling (see Challenge 2.10.21). Summary of Section 2.10 It is important to be able to simulate probability distributions. If X is discrete, taking the value xi with probability pi, where x1, j k 1 pk U, then Y has the same and U Uniform[0 1], and Y min x j : distribution as X. This method can be used to simulate virtually any discrete distribution. If F is any cumulative distribution with inverse cdf F 1, U and Y us to simulate virtually any continuous distribution. There are simple methods of simulating many standard distributions, including the binomial, uniform, exponential, and normal. Uniform[0 1], F 1 U, then Y has cumulative distribution function F. This allows x2 Chapter 2: Random Variables and Distributions 123 EXERCISES 5 2 1 6. Find a formula for Z in terms of U,
such that if U 2.10.1 Let Y be a discrete random variable with P Y 1 3, and P Y Uniform[0 1], then Z has the same distribution as Y. 2.10.2 For each of the following cumulative distribution functions F, find a formula for X in terms of U, such that if U Uniform[0 1], then X has cumulative distribution function F. (a) 1 2, P Y 7 (b) (c) (d) (e) (f 32 11 7 11 Uniform[0 1], and Y ln 1 U 3. What is the distribution of 2.10.3 Suppose U Y? 2.10.4 Generalizing the previous question, suppose U 0. ln 1 U (a) What is the distribution of W? (b) Does this provide a way of simulating from a certain well­known distribution? Explain. Uniform[0 1] and W for some fixed 124 Section 2.10: Simulating Probability Distributions x 2 4 1 7 0. 4 N 5 9. 1 2, and 1 3, P X 0 otherwise. 2 5 and P Y R1. for all t log 1 U1 cos 2 U2 y 1 6, P X R1. Uniform[0 1]. Find a formula for Y in terms of U, such that Y has cdf c2. Find values of c1 and c2 such that X Uniform[0 1]. Find a formula for Y in terms of U, such that P Y 1 5, otherwise P Y 2.10.5 Let U1 Uniform[0 1] and U2 Uniform[0 1] be independent, and let X c1 2.10.6 Let U 3 P Y 2.10.7 Suppose P X P X (a) Compute the cdf FX x for all x (b) Compute the inverse cdf F 1 t X (c) Let U FX. 2.10.8 Let X have density function f X x f X x (a) Compute the cdf FX x for all x (b) Compute the inverse cdf F 1 t X (c) Let U Uniform[0 1]. Find a formula for Y in terms of U, such that Y has density f. 2.10.9 Let U density f Z z Uniform[0 1]. Find a formula for Z in terms of U, such that Z has 4 z3 for
0 1, otherwise f Z z R1. for all t 3 x 2 for 0 1, otherwise R1. 0. 0. x z COMPUTER EXERCISES 1 N 1000 at least, with N N i 1 Xi and 1 N 2.10.10 For each of the following distributions, use the computer (you can use any algorithms available to you as part of a software package) to simulate X1 X2 X N i.i.d. having the given distribution. (Take N 100,000 if possible.) Then compute X (a) Uniform[0 1] (b) Uniform[5 8] (c) Bernoulli 1 3 (d) Binomial 12 1 3 (e) Geometric 1 5 (f) Exponential 1 (g) Exponential 13 (h) N 0 1 (i) N 5 9 10,000 or N N X i 1 Xi 2. PROBLEMS 0, 1 2 p2 F2 x p1 F1 x pk Fk x, where pi 2.10.11 Let G x 1, and Fi are cdfs, as in (2.5.3). Suppose we can generate Xi to have cdf Fi, for i k. Describe a procedure for generating a random variable Y that has cdf G. 2.10.12 Let X be an absolutely continuous random variable, with density given by 0 otherwise. Find a formula for Z in terms of f X x U, such that if U Uniform[0 1], then Z has the same distribution as X. 2.10.13 Find the inverse cdf of the logistic distribution of Problem 2.4.18. (Hint: See Problem 2.5.20.) 1, with f X x x 2 for x i pi Chapter 2: Random Variables and Distributions 125 distribution of Problem 2.4.19. (Hint: distribution of Problem 2.4.20. (Hint: 2.10.14 Find the inverse cdf of the Weibull See Problem 2.5.21.) 2.10.15 Find the inverse cdf of the Pareto See Problem 2.5.22.) 2.10.16 Find the inverse cdf of the Cauchy distribution of Problem 2.4.21. (Hint: See Problem 2.5.23.) 2.10.17 Find the inverse cdf of the Laplace distribution of Problem 2.4.22
. (Hint: See Problem 2.5.24.) 2.10.18 Find the inverse cdf of the extreme value distribution of Problem 2.4.23. (Hint: See Problem 2.5.25.) 2.10.19 Find the inverse cdfs of the beta distributions in Problem 2.4.24(b) through (d). (Hint: See Problem 2.5.26.) 2.10.20 (Method of composition) If we generate X ate Y from fY X f X obtaining x and then gener­ prove that Y fY x CHALLENGES 2.10.21 (Rejection sampling) Suppose f is a complicated density function. Suppose g is a density function from which it is easy to sample (e.g., the density of a uniform or exponential or normal distribution). Suppose we know a value of c such that f x R1. The following provides a method, called rejection sampling, for cg x for all x sampling from a complicated density f by using a simpler density g, provided only that we know f x cg x for all x (a) Suppose Y has density g. Let U Prove that Uniform[0 c], with U and Y independent. R1. P a Y b f Y Ucg Y b a f x dx Y b f Y cUg Y (Hint: Use Theorem 2.8.1 to show that P a b a g y P f Y cUg Y (b) Suppose that Y1 Y2 are i.i.d. Uniform[0 c]. Let i0 cg Y j. Prove that Xi1 Xi2 Xi1 Xi2.) y d y.) Y are i.i.d., each with density g, and independently U1 U2 in 1 : U j f Y j 1, let in min j 0, and for n are i.i.d., each with density f (Hint: Prove this for 2.11 Further Proofs (Advanced) Proof of Theorem 2.4.2 We want to prove that the function given by (2.4.9) is a density function. 126 Section 2.11: Further Proofs (Advanced) Clearly x 0 for all x. To proceed, we set I x dx. Then, using multivariable calculus, I 2 2 x dx x dx y dy x y dx dy 1 2 e x 2 y2 2 dx dy We
now switch to polar coordinates r y2 r dr d. Hence, 2. Then x 2 where r variable theorem from calculus, dx dy 0 and 0 r sin,, so that x r 2 and, by the multivariable change of and y r cos 2r dr d e r 2 2r dr 0 0 1 1 and we have I 2 claimed. 1. But clearly I 0 (because 0), so we must have I 1, as Proof of Theorem 2.6.2 We want to prove that, when X is an absolutely continuous random variable, with den­ R1 is a function that is differentiable sity function f X and Y and strictly increasing, then Y is also absolutely continuous, and its density function fY is given by h X, where h : R1 fY 2.11.1) where h is the derivative of h, and where h 1 y is the unique number x such that h x y. We must show that whenever a b, we have P a Y b b a fY y dy where fY is given by (2.11.1). To that end, we note that, because h is strictly increasing, so is h 1. Hence, applying h 1 preserves inequalities, so that dx We then make the substitution y h x, so that x h 1 y, and dx d dy h 1 y dy Chapter 2: Random Variables and Distributions 127 But by the inverse function theorem from calculus, d thermore, as x goes from h 1 a to h 1 b, we see that y We conclude that dy h 1 y 1 h h 1 y. Fur­ h x goes from a to b dy P a Y b as required dx b a fY y dy a Proof of Theorem 2.6.3 We want to prove that when X is an absolutely continuous random variable, with den­ R1 is a function that is differentiable sity function f X and Y and strictly decreasing, then Y is also absolutely continuous, and its density function fY may again be defined by (2.11.1). h X, where h : R1 We note that, because h is strictly decreasing, so is h 1. Hence, applying h 1 reverses the inequalities, so that dx We then make the substitution y h x, so that x h 1 y, and dx d dy h 1 y dy But by the inverse function theorem from calculus, d dy h 1 y 1 h h 1
y Furthermore, as x goes from h 1 b to h 1 a, we see that y We conclude that h x goes from a to b. P a Y b as required dx b a fY y dy dy 128 Section 2.11: Further Proofs (Advanced) Proof of Theorem 2.9.2 We want to prove the following result. Let X and Y be jointly absolutely continuous, with joint density function f X Y. Let Z h1 X Y and W h2 X Y, where h1 h2 : R2 R2 by R1 are differentiable functions. Define the joint function h h1 h2 : R2 h x y h1 x y h2 x y Assume that h is one­to­one, at least on the region y2. Then h1 x2 y2 and h2 x1 y1 h1 x1 y1 Z and W are also jointly absolutely continuous, with joint density function f Z W given by h2 x2 y2, then x1 x y : f x y x2 and y1 0, i.e., if where J is the Jacobian derivative of h, and where h 1 z such that h x y z. is the unique pair x y We must show that whenever a b and c d, we have dz If we let S as [a b] [c d] be the two­dimensional rectangle, then we can rewrite this P Z W S f Z W z dz d S Now, using the theory of multivariable calculus, and making the substitution x y h 1 z (which is permissible because h is one­to­one), we have f Z W z dz dz dx dy f X Y x y dx dy as required. Chapter 3 Expectation CHAPTER OUTLINE Section 1 The Discrete Case Section 2 The Absolutely Continuous Case Section 3 Variance, Covariance, and Correlation Section 4 Generating Functions Section 5 Conditional Expectation Inequalities Section 6 Section 7 General Expectations (Advanced) Section 8 Further Proofs (Advanced) In the first two chapters we learned about probability models, random variables, and distributions. There is one more concept that is fundamental to all of probability theory, that of expected value. Intuitively, the expected value of a random variable is the average value that the 0, and the other half of 5. 15, then random variable takes on. For example, if
half the time X the time X Similarly, if one­third of the time Y E Y 10, then the average value of X is 5. We shall write this as E X 6 while two­thirds of the time Y 12. Another interpretation of expected value is in terms of fair gambling. Suppose someone offers you a ticket (e.g., a lottery ticket) worth a certain random amount X. How much would you be willing to pay to buy the ticket? It seems reasonable that you would be willing to pay the expected value E X of the ticket, but no more. However, this interpretation does have certain limitations; see Example 3.1.12. To understand expected value more precisely, we consider discrete and absolutely continuous random variables separately. 3.1 The Discrete Case We begin with a definition. 129 130 Section 3.1: The Discrete Case Definition 3.1.1 Let X be a discrete random variable. Then the expected value (or mean value or mean) of X, written E X (or X ), is defined by E X x P X x x pX x x R1 x R1 We will have P X x Hence, an equivalent definition is the following. 0 except for those values x that are possible values of X. Definition 3.1.2 Let X be a discrete random variable, taking on distinct values x1 x2 xi. Then the expected value of X is given by, with pi P X E X xi pi i The definition (in either form) is best understood through examples. EXAMPLE 3.1.1 Suppose, as above, that P X 0 P X 10 1 2. Then E X 0 1 2 10 1 2 5 as predicted. EXAMPLE 3.1.2 Suppose, as above, that P Y 6 1 3, and P Y 15 2 3. Then E Y 6 1 3 15 2 3 2 10 12 again as predicted. EXAMPLE 3.1.3 Suppose that P Z 3 0 2, and P Z 11 0 7, and P Z 31 0 1. Then E Z 3 0 2 11 0 7 31 0 1 0 6 7 7 3 1 10 2 EXAMPLE 3.1.4 Suppose that P W Then 3 0 2, and P W 11 0 7, and P W 31 0 1. E W 3 0 2
11 0 7 31 In this case, the expected value of W is negative. We thus see that, for a discrete random variable X, once we know the probabilities that X x (or equivalently, once we know the probability function pX ), it is straightfor­ ward (at least in simple cases) to compute the expected value of X. We now consider some of the common discrete distributions introduced in Sec­ tion 2.3. Chapter 3: Expectation 131 EXAMPLE 3.1.5 Degenerate Distributions If X c is a constant, then P X c 1, so as it should. E X c 1 c EXAMPLE 3.1.6 The Bernoulli If X, then P X Bernoulli E X 1 1 Distribution and Indicator Functions 0 and P X, so 1 0 1 As a particular application of this, suppose we have a response s taking values in a I A s we have that X is the indicator function sample S and A of the set A and so takes the values 0 and 1 Then we have that P X and so X This implies that Bernoulli P A S Letting X s 1 P A E X E IA P A Therefore, we have shown that the expectation of the indicator function of the set A is equal to the probability of A EXAMPLE 3.1.7 The Binomial n If Y Binomial n, then Distribution P Y k for k 0 1 n. Hence, k P Y k k n! k Now, the binomial theorem says that for any a and b and any positive integer m bm j Using this, and setting j k 1, we see that 132 Section 3.1: The Discrete Case Hence, the expected value of Y is n. Note that this is precisely n times the ex­ as in Example 3.1.6. We shall see in pected value of X, where X Example 3.1.15 that this is not a coincidence. Bernoulli EXAMPLE 3.1.8 The Geometric If Z Geometric, then P Z Distribution k 1 k for k 0 1 2. Hence, E Z k 1 k k 0 (3.1.1) Therefore, we can write 1 E Z 1 1 0 Using the substitution k 1, we compute that 1 E Z k 1 1 k (3.1.2) k 1 Subtracting (3.1.2) from (3.1.1), we see that Hence
, E Z 1, and we obtain E Z 1. EXAMPLE 3.1.9 The Poisson, then P X If X Poisson 1, k Distribution e k k k! for k 0 1 2. Hence, setting E X k 0 e and we conclude that E X e k 1 e e ke k k It should be noted that expected values can sometimes be infinite, as the following example demonstrates. EXAMPLE 3.1.10 Let X be a discrete random variable, with probability function pX given by pX 2k 2 k Chapter 3: Expectation for k pX 4 1 2 3 1 4, pX 8 with pX x 0 for other values of x. That is, pX 2 1 8, etc., while pX 1 pX 3 pX 5 pX 6 133 1 2, 0. Then it is easily checked that pX is indeed a valid probability function (i.e., pX x 0 for all x, with x pX x 1). On the other hand, we compute that E X 2k 2 k k 1 1 k 1 We therefore say that E X, i.e., that the expected value of X is infinite. Sometimes the expected value simply does not exist, as in the following example. EXAMPLE 3.1.11 Let Y be a discrete random variable, with probability function pY given by pY y 1 2y 1 2 y 0 2 4 8 16 y y otherwise. 2 4 8 16 That is, pY 2 1 16, etc. Then it is easily checked that pY is indeed a valid probability function (i.e., pY y 0 for all y, with 1 8, pY 8 1 4, pY 4 1). pY pY pY 8 4 2 y pY y On the other hand, we compute that E Y y pY y y 1 2 2k 1 2 2k 2k 1 2 2k which is undefined. We therefore say that E Y does not exist, i.e., that the expected value of Y is undefined in this case. EXAMPLE 3.1.12 The St. Petersburg Paradox Suppose someone makes you the following deal. You will repeatedly ip a fair coin and will receive an award of 2Z pennies, where Z is the number of tails that appear before the first head.
How much would you be willing to pay for this deal? Well, the probability that the award will be 2z pennies is equal to the probability that you will ip z tails and then one head, which is equal to 1 2z 1. Hence, the expected value of the award (in pennies) is equal to 2z 1 2z 1 z 0 1 2 z 0 In words, the average amount of the award is infinite! Hence, according to the “fair gambling” interpretation of expected value, as dis­ cussed at the beginning of this chapter, it seems that you should be willing to pay an infinite amount (or, at least, any finite amount no matter how large) to get the award 134 Section 3.1: The Discrete Case promised by this deal! How much do you think you should really be willing to pay for it?1 EXAMPLE 3.1.13 The St. Petersburg Paradox, Truncated Suppose in the St. Petersburg paradox (Example 3.1.12), it is agreed that the award will be truncated at 230 cents (which is just over $10 million!). That is, the award will be the same as for the original deal, except the award will be frozen once it exceeds 230 cents. Formally, the award is now equal to 2min 30 Z pennies, where Z is as before. How much would you be willing to pay for this new award? Well, the expected value of the new award (in cents) is equal to 2min 30 z 1 2z 1 z 1 30 z 1 30 z 1 2z 1 2z 1 230 1 2z 1 z 31 1 2 230 1 231 31 2 15 5 That is, truncating the award at just over $10 million changes its expected value enor­ mously, from infinity to less than 16 cents! In utility theory, it is often assumed that each person has a utility function U such that, if they win x cents, their amount of “utility” (i.e., benefit or joy or pleasure) is equal to U x. In this context, the truncation of Example 3.1.13 may be thought of not as changing the rules of the game but as corresponding to a utility function of the min x 230. In words, this says that your utility is equal to the amount form U
x of money you get, until you reach 230 cents (approximately $10 million), after which point you don’t care about money2 anymore. The result of Example 3.1.13 then says that, with this utility function, the St. Petersburg paradox is only worth 15.5 cents to you — even though its expected value is infinite. We often need to compute expected values of functions of random variables. For­ tunately, this is not too difficult, as the following theorem shows. Theorem 3.1.1 (a) Let X be a discrete random variable, and let g : R1 such that the expectation of the random variable g X exists. Then R1 be some function b) Let X and Y be discrete random variables, and let h : R2 function such that the expectation of the random variable h X Y exists. Then R1 be some 1When one of the authors first heard about this deal, he decided to try it and agreed to pay $1. In fact, he got four tails before the first head, so his award was 16 cents, but he still lost 84 cents overall. 2Or, perhaps, you think it is unlikely you will be able to collect the money! Chapter 3: Expectation 135 PROOF We prove part (b) here. Part (a) then follows by simply setting h x y g x and noting that Let Z h X Y We have that as claimed. One of the most important properties of expected value is that it is linear, stated as follows. Theorem 3.1.2 (Linearity of expected values) Let X and Y be discrete random variables, let a and b be real numbers, and put Z a E X bY. Then E Z bE Y. a X PROOF Let pX Y be the joint probability function of X and Y. Then using Theo­ rem 3.1.1, E Z ax by pX Y x y a x pX Y x y b y pX Y x y x y a x pX pX Y x y x y Because y pX Y x y pX x and x pX Y x y pY y we have that E Z a x pX x b y pY y a E X bE Y x y as claimed. EXAMPLE 3.1.14 Binomial n Let X 1, and let Y Ge
ometric We already know (Examples 3.1.6 and 3.1.7) that E X 3E X 2. Hence, by Theorem 3.1.2, E 3X 2 2Y 2 2 2. What is E 3X 2Y? n 1 and E Y 3n 1 2E Y 1 2 1 EXAMPLE 3.1.15 Let Y Y Binomial n X1. Then we know (cf. Example 2.3.3) that we can think of 1 if the ith coin is Bernoulli (in fact, Xi Xn, where each Xi 136 Section 3.1: The Discrete Case heads, otherwise Xi Theorem 3.1.2 that 0). Because E Xi for each i, it follows immediately from E Y E X1 E Xn n This gives the same answer as Example 3.1.7, but much more easily. Suppose that X is a random variable and Y c is a constant. Then from Theorem X c 1 px E X c From this we see that the mean value 3.1.2, we have that E X X of X is a measure of the location of the probability distribution of X For example, if p then the X takes the value x with probability p and the value y with probability 1 p y which is a value between x and y For a constant c mean of X is the probability distribution of X c is concentrated on the points x c with probabilities p and 1 c which is between c i.e., the mean shifts with the probability distribution. It is the points x also true that if X is concentrated on the finite set of points x1 then xk and the mean shifts exactly as we shift the distribution. This is depicted x1 in Figure 3.1.1 for a distribution concentrated on k 4 points. Using the results of Section 2.6.1, we have that pX c x p respectively. The mean of X c is c and y c and y pX x x2 xk c X X pX x1 x2 E(X)  x3 x4 pX+c x1+c x2+c E(X+c)  x3+c x4+c Figure 3.1.1: The probability functions and means of discrete random variables X and X c. Theorem 3.1.2 says, in particular, that E X E Y, i
.e., that ex­ pectation preserves sums. It is reasonable to ask whether the same property holds for products. That is, do we necessarily have E X Y E X E Y? In general, the answer is no, as the following example shows. E X Y Chapter 3: Expectation 137 EXAMPLE 3.1.16 Let X and Y be discrete random variables, with joint probability function given by pX otherwise. 5 9 5 9 Then and while 19 3 y E XY z P XY z z 3 5 1 2 26 Because 4 19 3 26, we see that E X E Y E XY in this case. On the other hand, if X and Y are independent, then we do have E X E Y E XY. Theorem 3.1.3 Let X and Y be discrete random variables that are independent. Then E XY E X E Y. PROOF Independence implies (see Theorem 2.8.3) that P X P X y. Using this, we compute by Theorem 3.1.1 that x P Y x Y y E XY as claimed. Theorem 3.1.3 will be used often in subsequent chapters, as will the following impor­ tant property. Theorem 3.1.4 (Monotonicity) Let X and Y be discrete random variables, and suppose that X S.) Then E Y. E X Y. (Remember that this means X s Y s for all s 138 Section 3.1: The Discrete Case PROOF Let Z we have Z possible values of Z as z1 z2 Y Y, 0, so that all possible values of Z are nonnegative. Hence, if we list the X. Then Z is also discrete. Furthermore, because X then zi 0 for all i, so that E Z zi P Z zi 0 i But by Theorem 3.1.2. Hence, E Y E X 0, so that Summary of Section 3.1 x. x x P X The expected value E X of a random variable X represents the long­run average value that it takes on. If X is discrete, then E X The expected values of the Bernoulli, binomial, geometric, and Poisson distrib­ utions were computed. Expected value has an interpretation in terms of fair gambling, but such interpre­ tations require utility theory to accurately reect human behavior. Expected values of functions of one or two random variables can
also be com­ puted by summing the function values times the probabilities. Expectation is linear and monotone. If X and Y are independent, then E XY dence, this property may fail. E X E Y. But without indepen­ EXERCISES 3.1.1 Compute E X when the probability function of X is given by each of the fol­ lowing. (a) pX otherwise pX x pX otherwise 7 8 9 x otherwise (b) (c) Chapter 3: Expectation 139 3.1.2 Let X and Y have joint probability function given by pX otherwise 0 3 4 0 4 7Y as in Example 2.7.5. Compute each of the following. (a) E X (b) E Y (c) E 3X (d) E X 2 (e) E Y 2 (f) E XY (g) E X Y 3.1.3 Let X and Y have joint probability function given by 14 pX Y x y 1 2 1 6 1 12 1 12 1 12 1 12 otherwise 2 y 7 y 10 10 12 12 14 14 Y 2 4Y 1 and Y and Y Compute each of the following. (a) E X (b) E Y (c) E X 2 (d) E Y 2 (e) E X 2 (f) E XY Bernoulli 3.1.4 Let X 3.1.5 Let X Geometric 3.1.6 Let Y 3.1.7 Let X independent. Compute E X Y. 3.1.8 Starting with one penny, suppose you roll one fair six­sided die and get paid an additional number of pennies equal to three times the number showing on the die. Let X be the total number of pennies you have at the end. Compute E X. 3.1.9 Suppose you start with eight pennies and ip one fair coin. If the coin comes up heads, you get to keep all your pennies; if the coin comes up tails, you have to give half of them back. Let X be the total number of pennies you have at the end. Compute E X. 2. Compute E 4X Y. Compute E 8X Poisson 7. Compute E Y Binomial 100 0 3, and Z Binomial 80 1 4, and let Y Poisson 3 2. Assume X and Y are Bin
omial n Poisson 3Y. 12. Z. 140 Section 3.1: The Discrete Case 5. Compute E Y. 3 if the two coins show the same 3.1.10 Suppose you ip two fair coins. Let Y result, otherwise let Y 3.1.11 Suppose you roll two fair six­sided dice. (a) Let Z be the sum of the two numbers showing. Compute E Z. (b) Let W be the product of the two numbers showing. Compute E W. 3.1.12 Suppose you ip one fair coin and roll one fair six­sided die. Let X be the product of the numbers of heads (i.e., 0 or 1) times the number showing on the die. Compute E X. (Hint: Do not forget Theorem 3.1.3.) 3.1.13 Suppose you roll one fair six­sided die and then ip as many coins as the num­ ber showing on the die. (For example, if the die shows 4, then you ip four coins.) Let Y be the number of heads obtained. Compute E Y. 3.1.14 Suppose you roll three fair coins, and let X be the cube of the number of heads showing. Compute E X. PROBLEMS X., and let Y min X 100. 3.1.15 Suppose you start with one penny and repeatedly ip a fair coin. Each time you get heads, before the first time you get tails, you get two more pennies. Let X be the total number of pennies you have at the end. Compute E X. 3.1.16 Suppose you start with one penny and repeatedly ip a fair coin. Each time you get heads, before the first time you get tails, your number of pennies is doubled. Let X be the total number of pennies you have at the end. Compute E X. 3.1.17 Let X Geometric (a) Compute E Y. (b) Compute E Y E X. 3.1.18 Give an example of a random variable X such that E min X 100 3.1.19 Give an example of a random variable X such that E min X 100 E X 2. 3.1.20 Give an example of a joint probability function pX Y for random
variables X and Y, such that X 3.1.21 For X Hypergeometric N M n, prove that E X 3.1.22 For X Negative­Binomial r Argue that if X1 then X 3.1.23 Suppose that X1 X2 X3 Multinomial n E Xi, prove that E X Xr are independent and identically distributed Geometric Xr Negative­Binomial r Bernoulli 1 2, but E XY Bernoulli 1 4 and Y n M N r 1 3 Prove that (Hint: 1 8. n i X1 ) 1 2 CHALLENGES 3.1.24 Let X Geometric 3.1.25 Suppose X is a discrete random variable, such that E min X M Prove that P X M. Compute E X 2. 0. E X. Chapter 3: Expectation 141 DISCUSSION TOPICS 3.1.26 How much would you be willing to pay for the deal corresponding to the St. Petersburg paradox (see Example 3.1.12)? Justify your answer. 3.1.27 What utility function U (as in the text following Example 3.1.13) best describes your own personal attitude toward money? Why? 3.2 The Absolutely Continuous Case Suppose now that X is absolutely continuous, with density function f X. How can we compute E X then? By analogy with the discrete case, we might try computing x is always zero, this sum is always zero as x, but because P X x x P X well. On the other hand, if is a small positive number, then we could try approximating E X by E X i P i X i 1 i where the sum is over all integers i. This makes sense because, if i 1, then X X i i. is small and Now, we know that dx This tells us that E X Furthermore, in this integral dx 1. Hence, i x. We therefore see that E X i i x f X x dx x f X x dx This prompts the following definition. Definition 3.2.1 Let X be an absolutely continuous random variable, with density function f X. Then the expected value of X is given by E X x f X x dx From this definition, it is not too difficult to compute the expected values of many of the standard absolutely continuous distributions. EXAM
PLE 3.2.1 The Uniform[0 1] Distribution Let X Uniform[0 1] so that the density of X is given by f X x 1 0 0 1 x otherwise. 142 Hence, Section 3.2: The Absolutely Continuous Case E X x f X x dx 1 0 x dx x 2 2 x 1 x 0 1 2 as one would expect. EXAMPLE 3.2.2 The Uniform[L R] Distribution Let X Uniform[L R] so that the density of X is given by otherwise. Hence, E X x f X x dx R2 2 R L2 dx again as one would expect. EXAMPLE 3.2.3 The Exponential Let Y Exponential so that the density of Y is given by Distribution fY y y e 0 y y 0 0 Hence, integration by parts, with u leads to y and d e y (so du dy e y), E Y y fY y dy e y dy 0 0 y e y e y dy ye y 0 e y dy 0 0 1 1 0 In particular, if 1, then Y Exponential 1 and E Y 1. EXAMPLE 3.2.4 The N 0 1 Distribution Let Z N 0 1 so that the density of Z is given by f Z z z e z2 2 1 2 Hence, E Z z f Z z dz z z 0 1 2 1 2 e z2 2 dz e z2 2 dz z 0 1 2 e z2 2 dz (3.2.1) Chapter 3: Expectation 143 But using the substitution z, we see that 0 z 1 2 e z2 2 dz 0 e 2 2 d 1 2 Then the two integrals in (3.2.1) cancel each other out, and leaving us with E Z 0. As with discrete variables, means of absolutely continuous random variables can also be infinite or undefined. EXAMPLE 3.2.5 Let X have density function given by f X x 1 x 2 0 x 1 otherwise. Then E X x f X x dx x 1 x 2 dx 1 1 1 x dx log x x x 1 Hence, the expected value of X is infinite. EXAMPLE 3.2.6 Let Y have density function given by fY y 1 2y2 1 2y2 0 Then 1 y y otherwise. 1 E Y y fY y dy 1 y
1 y2 dy y 1 y2 dy 1 1 y dy 1 y dy 1 1 which is undefined. Hence, the expected value of Y is undefined (i.e., does not exist) in this case. Theorem 3.1.1 remains true in the continuous case, as follows. 144 Section 3.2: The Absolutely Continuous Case Theorem 3.2.1 (a) Let X be an absolutely continuous random variable, with density function f X, R1 be some function. Then when the expectation of g X exists, and let g : R1 E g X g x f X x dx (b) Let X and Y be jointly absolutely continuous random variables, with joint den­ R1 be some function. Then when the expecta­ sity function f X Y, and let h : R2 tion of h X Y exists dx dy We do not prove Theorem 3.2.1 here; however, we shall use it often. For a first use of this result, we prove that expected values for absolutely continuous random variables are still linear. Theorem 3.2.2 (Linearity of expected values) Let X and Y be jointly absolutely continuous random variables, and let a and b be real numbers. Then E a X bY a E X bE Y. PROOF Let rem 3.2.1, we compute that f X Y be the joint density function of X and Y. Then using Theo­ E Z ax by f X Y x y dx dy a a x f X Y x y dx dy b y f X Y x y dx dy x f X Y x y dy dx b y f X Y x y dx dy But f X Y x y dy f X x and f X Y x y dx fY y so E Z a x f X x dx b y fY y dy a E X bE Y as claimed. Just as in the discrete case, we have that E X c for an absolutely continuous random variable X Note, however, that this is not implied by Theorem 3.2.2 because the constant c is a discrete, not absolutely continuous, random variable. In fact, we need a more general treatment of expectation to obtain this result (see Sec­ tion 3.7). In any case, the result is true and we again have that the mean of a random E X c Chapter 3: Expectation 145 variable serves as a measure
of the location of the probability distribution of X In Figure 3.2.1, we have plotted the densities and means of the absolutely continuous ran­ dom variables X and X c The change of variable results from Section 2.6.2 give f X c x f X x c fX fX+c E(X)  E(X+c)  x x Figure 3.2.1: The densities and means of absolutely continuous random variables X and X c. 2 Distribution 2. Then we know (cf. Exercise 2.6.3) that if Z N 0 1. Hence, we can write X Z, where Z N EXAMPLE 3.2.7 The N Let X Z (see Example 3.2.4) that E Z using Theorem 3.2.2, E X 0 and (see Example 3.1.5) that E E Z E E Z 0 X, then N 0 1. But we know. Hence, If X and Y are independent, then the following results show that we again have E XY E X E Y. Theorem 3.2.3 Let X and Y be jointly absolutely continuous random variables that are independent. Then E XY E X E Y. PROOF Independence implies (Theorem 2.8.3) that Using this, along with Theorem 3.2.1, we compute f X Y x y f X x fY y. E XY x y f X Y x y dx dy x y f X x fY y dx dy x f X x dx y fY y dy E X E Y as claimed. The monotonicity property (Theorem 3.1.4) still holds as well. 146 Section 3.2: The Absolutely Continuous Case Theorem 3.2.4 (Monotonicity) Let X and Y be jointly continuous random vari­ ables, and suppose that X Y. Then E X E Y. PROOF Let f X Y be the joint density function of X and Y. Because X density f X Y can be chosen so that f X Y x y Y X. Then by Theorem 3.2.1(b), 0 whenever x y. Now let Z Y, the E Z y x f X Y x y dx dy 0 whenever x y, this implies that E Z E Y E X. Hence, E Y E X 0, so that E Y 0. But by Theo­ E X.
Because f X Y x y rem 3.2.2, E Z Summary of Section 3.2 If X is absolutely continuous, then E X The expected values of the uniform, exponential, and normal distributions were computed. Expectation for absolutely continuous random variables is linear and monotone. If X and Y are independent, then we still have E XY x f X x dx. E X E Y. EXERCISES 3.2.1 Compute C and E X when the density function of X is given by each of the following. (a) (b) (c) f X x C 0 5 9 x otherwise otherwise C x 4 0 5 x 2 otherwise 3.2.2 Let X and Y have joint density f X Y x y 2y5 4x 2 y 0 0 x otherwise 1 0 y 1 as in Examples 2.7.6 and 2.7.7. Compute each of the following. (a) E X (b) E Y Chapter 3: Expectation 147 7Y (c) E 3X (d) E X 2 (e) E Y 2 (f) E XY (g) E X Y 3.2.3 Let X and Y have joint density 14 f X Y x y 3x 2 y2 18 4x y 0 0 x otherwise 1 0 y 3 Compute each of the following. (a) E X (b) E Y (c) E X 2 (d) E Y 2 (e) E Y 4 (f) E X 2Y 3 3.2.4 Let X and Y have joint density f X Y x y 9 2 x 2 y2 6x y 0 0 x y otherwise 1 9] and Y Exponential 9. Compute E Exponential 9 and Z Exponential 9 and Z 5X N 8 9. Compute E 11X Compute each of the following. (a) E X (b) E Y (c) E X 2 (d) E Y 2 (e) E Y 4 (f) E X 2Y 3 3.2.5 Let X Uniform[3 7] and Y 3.2.6 Let X Uniform[ 12 3.2.7 Let Y 3.2.8 Let Y may use Problem 3.2.16 below.) 3.2.9 Suppose X has density function f x f x smallest. 3.2.10 Suppose X has density function f x erwise f x largest to smallest. 3.
2.11 Suppose men’s heights (in centimeters) follow the distribution N 174 202, while those of women follow the distribution N 160 152. Compute the mean total height of a man–woman married couple. 3.2.12 Suppose X and Y are independent, with E X 6. For each of the following variables Z, either compute E Z or explain why we cannot determine 2, otherwise 0. Compute each of E X, E X 2, and E X 3, and rank them from largest to 1, oth­ 0. Compute each of E X, E X 2, and E X 3 and rank them from Exponential 8. Compute E Y Gamma 5 4. Compute E Y 6Y. 14Y x 3 for 0 5 and E Y x 3 for 0 12 7 x 2 3 20 x 2 Z. (You Z. 3. x x 148 Section 3.2: The Absolutely Continuous Case Y 4Y 4Y 4Y 4Y X 3 X 3X X XY 2X 2X 3 2 2 E Z from the available information: (a) Z (b) Z (c) Z (d) Z (e) Z (f) Z 3.2.13 Suppose darts are randomly thrown at a wall. Let X be the distance (in cen­ timeters) from the left edge of the dart’s point to the left end of the wall, and let Y be the distance from the right edge of the dart’s point to the left end of the wall. Assume the dart’s point is 0 1 centimeters thick, and that E X 3.2.14 Let X be the mean height of all citizens measured from the top of their head, and let Y be the mean height of all citizens measured from the top of their head or hat (whichever is higher). Must we have E Y 3.2.15 Suppose basketball teams A and B each have five players and that each member of team A is being “guarded” by a unique member of team B. Suppose it is noticed that each member of team A is taller than the corresponding guard from team B. Does it necessarily follow that the mean height of team A is larger than the mean height of team B? Why or why not? E X? Why or why not? 214. Compute E Y. PROBLEMS 1 0 0 and Gamma 0, and let X. Prove that E X
distribution (see Problem 2.4.19). Prove 3.2.16 Let. (Hint: The computations are somewhat similar to those of Problem 2.4.15. You will also need property (2.4.7) of the gamma function.) 3.2.17 Suppose that X follows the logistic distribution (see Problem 2.4.18). Prove that E X 3.2.18 Suppose that X follows the Weibull 1 that E X 3.2.19 Suppose that X follows the Pareto 1. Prove that E X 1 What is E X when 0 3.2.20 Suppose that X follows the Cauchy distribution (see Problem 2.4.21). Argue that E X does not exist (Hint: Compute the integral in two parts, where the integrand is positive and where the integrand is negative.) 3.2.21 Suppose that X follows the Laplace distribution (see Problem 2.4.22). Prove that E X 3.2.22 Suppose that X follows the Beta a b distribution (see Problem 2.4.24). Prove that E X a a 3.2.23 Suppose that X1 X2 that E Xi i distribution (see Problem 2.4.20) for (see Problem 2.7.17). Prove Dirichlet 1 Chapter 3: Expectation 149 3.3 Variance, Covariance, and Correlation Now that we understand expected value, we can use it to define various other quantities of interest. The numerical values of these quantities provide information about the distribution of random variables. Given a random variable X, we know that the average value of X will be E X. However, this tells us nothing about how far X tends to be from E X. For that, we have the following definition. Definition 3.3.1 The variance of a random variable X is the quantity 2 X Var X E X 2 X (3.3.1) where X E X is the mean of X. E X 2 ; how­ We note that it is also possible to write (3.3.1) as Var X E X 2 is always ever, the multiple uses of “E” may be confusing. Also, because X nonnegative, its expectation is always defined, so the variance of X is always defined
. Intuitively, the variance Var X is a measure of how spread out the distribution of X is, or how random X is, or how much X varies, as the following example illustrates. X EXAMPLE 3.3.1 Let X and Y be two discrete random variables, with probability functions and pX x pY y 1 0 1 2 1 2 0 x 10 otherwise 5 y y 15 otherwise respectively. Then E X E Y 10. However, Var X 10 10 2 1 0 while Var Y 5 10 2 1 2 15 10 2 1 2 25 We thus see that, while X and Y have the same expected value, the variance of Y is much greater than that of X. This corresponds to the fact that Y is more random than X; that is, it varies more than X does. EXAMPLE 3.3.2 Let X have probability function given by pX otherwise. 150 Section 3.3: Variance, Covariance, and Correlation Then Hence, 3 2 1 6 5 4 3. Var X 2 EXAMPLE 3.3.3 Bernoulli Let Y. Then E Y. Hence, Var. The square in (3.3.1) implies that the “scale” of Var X is different from the scale of X. For example, if X were measuring a distance in meters (m), then Var X would be measuring in meters squared (m2). If we then switched from meters to feet, we would have to multiply X by about 3 28084 but would have to multiply Var X by about 3 28084 2. To correct for this “scale” problem, we can simply take the square root, as follows. Definition 3.3.2 The standard deviation of a random variable X is the quantity X Sd X Var X E X 2 X X omitted the square and considered E X It is reasonable to ask why, in (3.3.1), we need the square at all. Now, if we simply X, we would always get zero (because E X ), which is useless. On the other hand, we could instead use E X X. This would, like (3.3.1), be a valid measure of the average distance of X from X. Furthermore, it would not have the “scale problem” that Var X does. However, we is shall see that Var X has many convenient properties. By contrast, E X very dif
ficult to work with. Thus, it is purely for convenience that we define variance by E X 2 instead of E X X X. X Variance will be very important throughout the remainder of this book. Thus, we pause to present some important properties of Var. 0. Theorem 3.3.1 Let X be any random variable, with expected value and variance Var X. Then the following hold true: (a) Var X (b) If a and b are real numbers, Var a X E X 2 (c) Var X X second moment minus the square of the first moment.) (d) Var X a2 Var. (That is, variance is equal to the X E X, PROOF (a) This is immediate, because we always have X (b) We note that a X again using linearity. b, by linearity. Hence, Var a2 E X 2 X a2 Var X Chapter 3: Expectation (c) Again, using linearity, 151 Var 2X X 2E d) This follows immediately from part (c) because we have 2 X 0. Theorem 3.3.1 often provides easier ways of computing variance, as in the follow­ ing examples. EXAMPLE 3.3.4 Variance of the Exponential Let W Exponential e integration by parts,, so that fW Distribution. Then E W 1. Also, using Hence, by part (c) of Theorem 3.3.1, Var EXAMPLE 3.3.5 Let W Var W Exponential 1, and let Y 5W 3. Then from the above example, 2. Then, using part (b) of Theorem 3.3.1, Var Y Var 5W 3 25 Var W 2 25 Because a2 ing fact about standard deviation. a, part (b) of Theorem 3.3.1 immediately implies a correspond­ Corollary 3.3.1 Let X be any random variable, with standard deviation Sd X, and let a be any real number. Then Sd a X a Sd X. EXAMPLE 3.3.6 Let W Exponential see that Sd W 25 2 1 2 5, and let Y 5W 3. Then using the above examples, we 2 1 2 Var Y 1 2 Var W 1 2 This agrees with Corollary 3.3.1, since Sd Y Also, Sd
Y 1 1 EXAMPLE 3.3.7 Variance and Standard Deviation of the N Suppose that X we compute Var X First consider Z N 2 N 0 1 Then from Theorem 3.3.1(c) we have that In Example 3.2.7 we established that E X Now 5 Sd W. 2 Distribution Var Z E Z 2 z2 1 2 exp z2 2 dz 152 Section 3.3: Variance, Covariance, and Correlation Then, putting u integration by parts, we obtain z d z exp z2 2 (so du 1 exp z2 2 ), and using Var Z 1 2 z exp z2 2 1 2 exp z2 2 dz 1 and Sd Z 1 Now, for 0 put X Z We then have X N 2. From Theorem 3.3.1(b) we have that Var X Var Z 2 Var Z 2 and Sd X the standard deviation as This establishes the variance of the N 2 distribution as 2 and In Figure 3.3.1, we have plotted three normal distributions, all with mean 0 but different variances. f 1.0 0.8 0.6 0.4 0.2 ­5 ­4 ­3 ­2 ­1 0 1 2 3 4 5 x Figure 3.3.1: Plots of the the N 0 1 (solid line), the N 0 1 4 (dashed line) and the N 0 4 (dotted line) density functions. The effect of the variance on the amount of spread of the distribution about the mean 2 increases, the distribution becomes more diffuse; is quite clear from these plots. As as it decreases, it becomes more concentrated about the mean 0. So far we have considered the variance of one random variable at a time. How­ ever, the related concept of covariance measures the relationship between two random variables. Definition 3.3.3 The covariance of two random variables X and Y is given by Cov X Y E X X Y Y where X E X and Y E Y. EXAMPLE 3.3.8 Let X and Y be discrete random variables, with joint probability function pX Y given Chapter 3: Expectation 153 by Then E X 6 1 3 Cov X Y pX otherwise 10 3, and E Y 4 1 2 6 1 6 5. Hence, 10 3 Y 5 5 2 10 3 4 E X 3 1 3 3 10 3 6 5 3 5 10 3
6 5 6 EXAMPLE 3.3.9 Let X be any random variable with Var X Y 3 X and Z 4 X. Hence, 0. Let Y 3X, and let Z 4X. Then Cov Var X X 3X 3 X while Cov Var X X 4 X 4 X Note in particular that Cov X Y Y increases when X increases, whereas Z decreases when X increases. 0, while Cov X Z 0. Intuitively, this says that We begin with some simple facts about covariance. Obviously, we always have Cov X Y Cov Y X We also have the following result. Theorem 3.3.2 (Linearity of covariance) Let X, Y, and Z be three random vari­ ables. Let a and b be real numbers. Then Cov a X bY Z a Cov X Z b Cov Y Z PROOF Note that by linearity, a X b Y. Hence, a X bY E a X bY a E X bE Y Cov a X bY Z a X bY Z Z a X bY b Y Z b Y Z Z Z bY bY Cov X Z X Z Z bE Y Y Z Z b Cov Y Z and the result is established. We also have the following identity, which is similar to Theorem 3.3.1(c). 154 Section 3.3: Variance, Covariance, and Correlation Theorem 3.3.3 Let X and Y be two random variables. Then Cov X Y E XY E X E Y PROOF Using linearity, we have Cov X Y E X E XY E XY X Y X E Y Y E XY XY X Y Corollary 3.3.2 If X and Y are independent, then Cov X Y 0. PROOF Because X and Y are independent, we know (Theorems 3.1.3 and 3.2.3) E X E Y. Hence, the result follows immediately from Theorem 3.3.3. that E X Y We note that the converse to Corollary 3.3.2 is false, as the following example shows. EXAMPLE 3.3.10 Covariance 0 Does Not Imply Independence. Let X and Y be discrete random variables, with joint probability function pX Y given by pX otherwise. 5 9 5 9 Then 35 and E XY 35 We obtain Cov XY On the other hand, X and Y are clearly
not independent. For example, P X 5 0, but P X 0, so and P Y 4 P Y 5 5. There is also an important relationship between variance and covariance. Theorem 3.3.4 (a) For any random variables X and Y, Var X Y Var X Var Y 2 Cov X Y (b) More generally, for any random variables X1 Xn, Var Xi Var Xi 2 Cov Xi X j i i i j Chapter 3: Expectation 155 PROOF We prove part (b) here; part (a) then follows as the special case n 2. Note that by linearity, Xi E Xi i Xi i i Xi E Therefore, we have that Var Xi i i 2 Xi i Xi 2 Xi i E i i Xi i X j i j E Xi i X j j j 2 i j E Xi i Xi i i i i j E Xi i X j 2 E Xi Var Xi 2 Cov Xi Combining Theorem 3.3.4 with Corollary 3.3.2, we obtain the following. Corollary 3.3.3 (a) If X and Y are independent, then Var X Xn are independent, then Var (b) If X1 Var X Y n i 1 Xi Var Y n i 1Var Xi One use of Corollary 3.3.3 is the following. EXAMPLE 3.3.11 Binomial n Let Y. What is Var Y? Recall that we can write Y X1 X2 Xn where the Xi are independent, with Xi Var Xi. Hence, from Corollary 3.3.3, 1 Bernoulli. We have already seen that Var Y Var X1 1 Var X2 1 Var Xn 1 n 1. Another concept very closely related to covariance is correlation. 156 Section 3.3: Variance, Covariance, and Correlation Definition 3.3.4 The correlation of two random variables X and Y is given by Corr X Y Cov X Y Sd X Sd Y Cov X Y Var X Var Y provided 0 Var X and 0 Var Y EXAMPLE 3.3.12 As in Example 3.3.2, let X be any random variable with Var X let Z Corollary 3.3.1, Sd Y 3 Var X and Cov X Z 4X. Then Cov X Y 3 Sd X and Sd Z 4 Sd X.
Hence, 3X, and 0, let Y 4 Var X. But by Corr X Y Cov X Y Sd X Sd Y 3 Var X Sd X 3 Sd X Var X Sd X 2 1 because Sd X 2 Var X. Also, we have that Corr X Z Cov X Z Sd X Sd Z 4 Var X Sd X 4 Sd X Var X Sd X 2 1 Intuitively, this again says that Y increases when X increases, whereas Z decreases 4 have cancelled out; when X increases. However, note that the scale factors 3 and only their signs were important. We shall see later, in Section 3.6, that we always have 1, for any random variables X and Y. Hence, in Example 3.3.12, Y has the largest possible correlation with X (which makes sense because Y increases whenever X does, without exception), while Z has the smallest possible correlation with X (which makes sense because Z decreases whenever X does). We will also see that Corr X Y is a measure of the extent to which a linear relationship exists between X and Y. 1 Corr X Y 2 1 EXAMPLE 3.3.13 The Bivariate Normal We defined this distribution in Example 2.7.9. It turns out that when X Y follows this joint distribution then, (from Problem 2.7.13) X Further, we have that (see Problem 3.3.17) Corr X Y we have plotted samples of n 2 utions with 1 1 (2.7.1) to generate these samples. 2 1 and Y In the following graphs, 1000 values of X Y from bivariate normal distrib­ 1 and various values of Note that we used Distribution From these plots we can see the effect of on the joint distribution. Figure 3.3.2 0 the point cloud is roughly circular. It becomes elliptical in 0 5 and more tightly concentrated about a line in Figure 3.3.4 0 9 As we will see in Section 3.6, the points will lie exactly on a line when shows that when Figure 3.3.3 with with 1 Figure 3.3.5 demonstrates the effect of a negative correlation. With positive corre­ lations, the value of Y tends to increase with X as reected in the upward slope of the point cloud. With negative correlations, Y tends to decrease with X as reected in the
negative slope of the point cloud. Chapter 3: Expectation 157 Y 4 3 2 1 0 ­1 ­2 ­3 ­4 ­5 ­4 ­3 ­2 ­1 1 2 3 4 5 0 X Figure 3.3.2: A sample of n distribution. 1000 values X Y from the Bivariate Normal 1 ­2 ­3 ­4 ­5 ­4 ­3 ­2 ­1 1 2 3 4 5 0 X Figure 3.3.3: A sample of n 0 0 1 1 0 5 distribution. 1000 values X Y from the Bivariate Normal 158 Section 3.3: Variance, Covariance, and Correlation Y 4 3 2 1 0 ­1 ­2 ­3 ­4 ­5 ­4 ­3 ­2 ­1 1 2 3 4 5 0 X Figure 3.3.4: A sample of n 0 0 1 1 0 9 distribution. 1000 values X Y from the Bivariate Normal Y 4 3 2 1 0 ­1 ­2 ­3 ­4 ­5 ­4 ­3 ­2 ­1 1 2 3 4 5 0 X Figure 3.3.5: A sample of n 0 0 1 1 0 9 distribution. 1000 values X Y from the Bivariate Normal Chapter 3: Expectation 159 Summary of Section 3.. 0, and Var a X The variance of a random variable X measures how far it tends to be from its mean and is given by Var X The variances of many standard distributions were computed. The standard deviation of X equals Sd X Var X The covariance of random variables X and Y measures how they are related and X Y is given by Cov X Y If X and Y are independent, then Cov X Y Var X this equals Var X The correlation of X and Y is Corr X Y Var X. a2 Var X ; also Sd a X 2 Cov X Y. If X and Y are independent, E X E Y. Sd X Sd Y a Sd X. Cov X Y Var Y. Var X E XY Var Y E X 0. Y b b y EXERCISES 3.3.1 Suppose the joint probability function of X and Y is given by pX otherwise 5 9 5 9 4, E Y 19 3, and E XY with E X (a) Compute Cov X Y. (b) Compute Var X and Var Y. (c) Compute Corr X Y. 3.3.2 Suppose the joint probability function of X and
Y is given by 26, as in Example 3.1.16. pX otherwise 0 3 4 0 4 as in Example 2.7.5. (a) Compute E X and E Y. (b) Compute Cov X Y. (c) Compute Var X and Var Y. (d) Compute Corr X Y. 3.3.3 Let X and Y have joint density f X Y x y 2y5 4x 2 y 0 0 x otherwise 1 0 y 1 160 Section 3.3: Variance, Covariance, and Correlation as in Exercise 3.2.2. Compute Corr X Y. 3.3.4 Let X and Y have joint density f X Y x y 15x 3 y4 0 6x 2 y7 0 x otherwise 1 0 y 1 1 1 0. Y Z E X X L 2 12 E X E X Exponential 3 and Y Y. Cov Y Z. Poisson 5. Assume X and Y are independent. Compute E X, E Y, Var X, Var Y, Cov X Y, and Corr X Y. 3.3.5 Let Y and Z be two independent random variables, each with positive variance. Prove that Corr Y Z 3.3.6 Let X, Y, and Z be three random variables, and suppose that X and Z are inde­ pendent. Prove that Cov X 3.3.7 Let X X Let Z (a) Compute Cov X Z. (b) Compute Corr X Z. 3.3.8 Prove that the variance of the Uniform[L R] distribution is given by the expres­ sion R 3.3.9 Prove that Var X directly from the probability function that when X n 3.3.10 Suppose you ip three fair coins. Let X be the number of heads showing, and let Y 3.3.11 Suppose you roll two fair six­sided dice. Let X be the number showing on the first die, and let Y be the sum of the numbers showing on the two dice. Compute E X, E Y, E X Y, and Cov X Y. 3.3.12 Suppose you ip four fair coins. Let X be the number of heads showing, and let Y be the number of tails showing. Compute Cov X Y and Corr X Y. 3.3.
13 Let X and Y be independent, with X Y and W X Let Z N 0 1. Let 3.3.14 Let X and Y be independent, with X Z X Y and W X Y. Compute Var Z, Var W, Cov Z W, and Corr Z W. 3.3.15 Suppose you roll one fair six­sided die and then ip as many coins as the num­ ber showing on the die. (For example, if the die shows 4, then you ip four coins.) Let X be the number showing on the die, and Y be the number of heads obtained. Compute Cov X Y. X 2. Compute E X, E Y, Var X, Var Y, Cov X Y, and Corr X Y. Y. Compute Cov Z W and Corr Z W. 1 Use this to compute Bernoulli 1 2 and Y Bernoulli 1 2 and Y Bernoulli 1 3. Binomial n then Var X X PROBLEMS cX. N 0 1, and let Y 3.3.16 Let X (a) Compute limc 0 Cov X Y. (b) Compute limc 0 Cov X Y. (c) Compute limc 0 Corr X Y. (d) Compute limc 0 Corr X Y. (e) Explain why the answers in parts (c) and (d) are not the same. Chapter 3: Expectation 161 x 2 1 x x 0 and 0, and let X. (Hint: Use (2.7.1).) distribution is given by 1 2 (Hint: Use Problem 3.3.18.) x 2 ) distribution is given by 3.3.17 Let X and Y have the bivariate normal distribution, as in Example 2.7.9. Prove that Corr X Y 3.3.18 Prove that the variance of the Geometric (Hint: Use Exercise 3.3.9 and 1 1 3.3.19 Prove that the variance of the Negative­Binomial r r 1 3.3.20 Let (Hint: Recall Problem 3.2.16.) 3.3.21 Suppose that X Weibull Var X 3.3.22 Suppose that X 1 2 Var X 3.3.23 Suppose that X follows the Laplace distribution (see Problem 2.4.22). Prove that Var X 3.
3.24 Suppose that X b 2 a 1 ab 3.3.25 Suppose that X1 X2 X3 Multinomial n 2 1 Pareto (see Problem 2.4.20) for 2. (Hint: Recall Problem 3.2.19.) Beta a b (see Problem 2.4.24). Prove that Var X (Hint: Recall Problem 3.2.22.) distribution (see Problem 2.4.19). Prove that 2 (Hint: Recall Problem 3.2.21.) (Hint: Recall Problem 3.2.18.). Prove that Var X 3. Prove that 2. Prove that Gamma 2. a b 1 1 2 1 2 Var Xi n i 1 i Cov Xi X j n i j when i j (Hint: Recall Problem 3.1.23.) 3.3.26 Suppose that X1 X2 that Dirichlet 1 2 3 (see Problem 2.7.17). Prove Var Xi Cov X1 X2 Hint: Recall Problem 3.2.23.) 3.3.27 Suppose that X Hypergeometric N M n. Prove that Var Hint: Recall Problem 3.1.21 and use Exercise 3.3.9.) 3.3.28 Suppose you roll one fair six­sided die and then ip as many coins as the num­ ber showing on the die. (For example, if the die shows 4, then you ip four coins.) Let X be the number showing on the die, and Y be the number of heads obtained. Compute Corr X Y. CHALLENGES 3.3.29 Let Y be a nonnegative random variable. Prove that E Y P Y for any Y.) 0 if and only if 1. (You may assume for simplicity that Y is discrete, but the result is true 0 162 Section 3.4: Generating Functions 3.3.30 Prove that Var X 1 (You may use the result of Challenge 3.3.29.) 3.3.31 Give an example of a random variable X, such that E X 0 if and only if there is a real number c with P X 5, and Var X c. 3.4 Generating Functions Let X be a random variable. Recall that the cumulative distribution function of X, defined by FX x x, contains all the information about the distribution of X (
see Theorem 2.5.1). It turns out that there are other functions — the probability­ generating function and the moment­generating function — that also provide informa­ tion (sometimes all the information) about X and its expected values. P X Definition 3.4.1 Let X be a random variable (usually discrete). Then we define its probability­generating function, rX, by rX t E t X for t R1 Consider the following examples of probability­generating functions. EXAMPLE 3.4.1 The Binomial n If X Binomial n, then rX using the binomial theorem. EXAMPLE 3.4.2 The Poisson If Y Poisson then Distribution Distribution rY! t i e i 0 The following theorem tells us that once we know the probability­generating func­ 2, tion rX t, then we can compute all the probabilities P X etc. 0, P X 1, P X Chapter 3: Expectation 163 Theorem 3.4.1 Let X be a discrete random variable, whose possible values are all nonnegative integers. Assume that rX t0 for some t0 0. Then etc. In general, rX 0 rX 0 rX! P X k where r k X is the kth derivative of rX. PROOF Because the possible values are all nonnegative integers of the form i 0 1 2 we have rX so that rX t 1P 3.4.1) Substituting t P X rX 0 0 into (3.4.1), every term vanishes except the first one, and we obtain 0. Taking derivatives of both sides of (3.4.1), we obtain rX t 1P X 1 2t 1 P X 2 3t 2 P X 3 0 gives rX 0 P X 1. Taking another derivative of both sides and setting t gives rX t 0 gives rX 0 2P X 2 2 P X and setting t general formula. 3 2 t 1 P X 2. Continuing in this way, we obtain the 3 We now apply Theorem 3.4.1 to the binomial and Poisson distributions. EXAMPLE 3.4.3 The Binomial n From Example 3.4.1, we have that Distribution rX 0 rX 0 rX etc. It is thus verified directly that rX
0 rX 0 rX 0 164 etc. EXAMPLE 3.4.4 The Poisson From Example 3.4.2, we have that Distribution Section 3.4: Generating Functions etc. It is again verified that rX 0 rX 0 rX 0 e e 2e rX 0 rX 0 rX 0 etc. From Theorem 3.4.1, we can see why rX is called the probability­generating func­ tion. For, at least in the discrete case with the distribution concentrated on the non­ negative integers, we can indeed generate the probabilities for X from rX We thus see immediately that for a random variable X that takes values only in 0 1 2, and rX is unique. By this we mean that if X and Y are concentrated on 0 1 2 rX rY then X and Y have the same distribution. This uniqueness property of the probability­generating function can be very useful in trying to determine the distribu­ tion of a random variable that takes only values in 0 1 2 It is clear that the probability­generating function tells us a lot — in fact, everything — about the distribution of random variables concentrated on the nonnegative integers. But what about other random variables? It turns out that there are other quantities, called moments, associated with random variables that are quite informative about their distributions. Definition 3.4.2 Let X be a random variable, and let k be a positive integer. Then the kth moment of X is the quantity E X k provided this expectation exists. Note that if E X k exists and is finite, it can be shown that E Xl exists and is finite when 0 k. l The first moment is just the mean of the random variable. This can be taken as a measure of where the central mass of probability for X lies in the real line, at least when this distribution is unimodal (has a single peak) and is not too highly skewed. The second moment E X 2 together with the first moment, gives us the variance through E X 2 Therefore, the first two moments of the distribution tell Var X us about the location of the distribution and the spread, or degree of concentration, of that distribution about the mean. In fact, the higher moments also provide information about the distribution. E X 2 Many of the most important distributions
of probability and statistics have all of their moments finite; in fact, they have what is called a moment­generating function. Chapter 3: Expectation 165 Definition 3.4.3 Let X be any random variable. Then its moment­generating func­ tion m X is defined by m X s E es X at s R1. The following example computes the moment­generating function of a well­known distribution. EXAMPLE 3.4.5 The Exponential. Then for s Let X Exponential Distribution, m X s E es X esx f X x dx e s x dx e s s 1 s 0 s esx e x dx comparison of Definitions 3.4.1 and 3.4.3 immediately gives the following. Theorem 3.4.2 Let X be any random variable. Then m X s rX es. This result can obviously help us evaluate some moment­generating functions when we have rX already. Binomial n es EXAMPLE 3.4.6 Let Y rY es EXAMPLE 3.4.7 Let Z Poisson e es 1 1. Then we know that rY t n t 1 n Hence, mY s. Then we know that rZ t e t 1 Hence, m Z s rZ es The following theorem tells us that once we know the moment­generating function m X t, we can compute all the moments, etc. Theorem 3.4.3 Let X be any random variable. Suppose that for some s0 true that m X s s0 s0. Then whenever s 0, it is etc. In general where m k X is the kth derivative of m X. PROOF We know that m X s E es X. We have m X 0 E e0X E e0 E 1 1 166 Section 3.4: Generating Functions Also, taking derivatives, we see3 that m X s E X es X, so m X 0 E X e0X E Xe0 E X Taking derivatives again, we see that m X s E X 2es X, so m X 0 E X 2 e0X E X 2e0 E X 2 Continuing in this way, we obtain the general formula. We now consider an application of Theorem 3.4.3 EXAMPLE 3.4.8 The Mean and Variance of
the Exponential Using the moment­generating function computed in Example 3.4.5, we have Distribution Therefore, as it should. Also, E X 2 so we have Var This provides an easy way of computing the variance of X. EXAMPLE 3.4.9 The Mean and Variance of the Poisson In Example 3.4.7, we obtained m Z s exp es 1 Distribution So we have e0 exp e0 exp e0 e0 1 1 e0 2 exp e0 1 2 Therefore, Var X E X 2 E X 2 2 2 Computing the moment­generating function of a normal distribution is also impor­ tant, but it is somewhat more difficult. Theorem 3.4.4 If X N 0 1 then m X s es2 2. PROOF Because X has density x 2 1 2 e x 2 2, we have that m X s E es X 1 2 es2 2 1 2 esx x dx esx x 2 2 dx 1 2 e x s 2 2 dx esx 1 2 e x 2 2 dx e x s 2 2 s2 2 dx 3Strictly speaking, interchanging the order of derivative and expectation is justified by analytic function s0. theory and requires that m X s whenever s Chapter 3: Expectation 167 Setting y x s (so that dy dx), this becomes (using Theorem 2.4.2) m X s es2 2 1 2 as claimed. e y2 2 dy es2 2 y dy es2 2 One useful property of both probability­generating and moment­generating func­ tions is the following. Theorem 3.4.5 Let X and Y be random variables that are independent. Then we have (a) rX Y t (b) m X Y t rX t rY t, and m X t mY t. PROOF Because X and Y are independent, so are t X and t Y (by Theorem 2.8.5). Hence, we know (by Theorems 3.1.3 and 3.2.3) that. Using this, we have rX rX t rY t Similarly, m X Y t E et X Y E et X etY E et X E et Y m X t mY t EXAMPLE 3.4.10 Binomial n Let Y. Then, as in Example 3.1.15,
we can write Y X1 Xn where the Xi are i.i.d. with Xi have rY t rX1 t rX2 t Bernoulli rX n t But for any i,. Hence, Theorem 3.4.5 says we must rXi Hence, we must have rY as already verified in Example 3.4.1. Moment­generating functions, when defined in a neighborhood of 0, completely define a distribution in the following sense. (We omit the proof, which is advanced.) Theorem 3.4.6 (Uniqueness theorem) Let X be a random variable, such that for s0 s0. Then if Y is some some s0 other random variable with mY s s0 s0, then X and Y have the same distribution. whenever s m X s whenever s 0, we have m X s 168 Section 3.4: Generating Functions Theorems 3.4.1 and 3.4.6 provide a powerful technique for identifying distribu­ tions. For example, if we determine that the moment­generating function of X is m X t N 0 1 We can use this approach to determine the distributions of some complicated random variables. then we know, from Theorems 3.4.4 and 3.4.6, that X exp s2 2 EXAMPLE 3.4.11 Suppose that Xi 1 independent. Consider the distribution of Y N i for i 2 i When n 1 we have (from Problem 3.4.15) n i 1 Xi n and that these random variables are mY s exp 1s 2 1s2 2 Then, using Theorem 3.4.5, we have that mY s n m Xi s i 1 exp n i 1 n i 1 s i exp i s i s2 2 2 2 i s2 n i 1 2 From Problem 3.4.15, and applying Theorem 3.4.6, we have that Generating functions can also help us with compound distributions, which are de­ fined as follows. Definition 3.4.4 Let X1 X2 random variable which is independent of the Xi. Let be i.i.d., and let N be a nonnegative, integer­valued S N i 1 Xi (3.4.2) Then S is said to have a compound distribution. 0
when N A compound distribution is obtained from a sum of i.i.d. random variables, where the number of terms in the sum is randomly distributed independently of the terms in 0 Such distributions have applications in ar­ the sum. Note that S eas like insurance, where the X1 X2 are claims and N is the number of claims presented to an insurance company during a period. Therefore, S represents the total amount claimed against the insurance company during the period. Obviously, the in­ surance company wants to study the distribution of S, as this will help determine what it has to charge for insurance to ensure a profit. The following theorem is important in the study of compound distributions. Chapter 3: Expectation 169 Theorem 3.4.7 If S has a compound distribution as in (3.4.2), then (a) E S (b) m S s E X1 E N.. rN m X1 s PROOF See Section 3.8 for the proof of this result. 3.4.1 Characteristic Functions (Advanced) One problem with moment­generating functions is that they can be infinite in any open interval about s 0. Consider the following example. EXAMPLE 3.4.12 Let X be a random variable having density f X x 1 x 2 0 x 1 otherwise. Then m X s E es X esx 1 x 2 dx 1 0, we know that esx grows faster than x 2, so that limx esx x 2. For any s Hence, m X s whenever s Does X have any finite moments? We have that 0. E X x 1 x 2 dx 1 1 1 x dx ln x x x 1 so, in fact, the first moment does not exist. From this we conclude that X does not have any moments. The random variable X in the above example does not satisfy the condition of Theorem 3.4.3 that m X s 0. Hence, The­ orem 3.4.3 (like most other theorems that make use of moment­generating functions) does not apply. There is, however, a similarly defined function that does not suffer from this defect, given by the following definition. s0, for some s0 whenever s Definition 3.4.5 Let X be any random variable. Then we de�
��ne its characteristic function, cX, by (3.4.3) for s R1 cX s E ei s X So the definition of cX is just like the definition of m X, except for the introduction 1. Using properties of complex numbers, we see of the imaginary number i that (3.4.3) can also be written as cX s Consider the following examples. i E sin s X for s E cos s X R1 170 Section 3.4: Generating Functions EXAMPLE 3.4.13 The Bernoulli Distribution Let X Bernoulli. Then cX s E ei s X 1 1 1 ei s0 1 ei s cos s i 1 sin s ei s1 eis EXAMPLE 3.4.14 Let X have probability function given by pX otherwise. Then cX s E ei s X 1 6 cos 2s eis2 1 6 ei s3 1 3 ei s4 1 2 1 3 cos 3s 1 2 cos 4s 1 6 i sin 2s 1 3 i sin 3s i 1 2 sin 4s EXAMPLE 3.4.15 Let Z have probability function given by pZ z 1 2 1 2 0 1 z z otherwise. 1 Then cZ s E eis Z 1 2 cos s 1 2 cos s ei cos 1 2 cos s s 1 2 sin s 1 2 sin 1 2 sin s 1 2 sin s s cos s Hence, in this case, cZ s is a real (not complex) number for all s R1. Once we overcome our “fear” of imaginary and complex numbers, we can see that the characteristic function is actually much better in some ways than the moment­ generating function. The main advantage is that, because ei s X i sin s X and ei s X 1, the characteristic function (unlike the moment­generating function) is always finite (although it could be a complex number). cos s X Theorem 3.4.8 Let X be any random variable, and let s be any real number. Then cX s is finite. The characteristic function has many properties similar to the moment­generating function. In particular, we have the following. (The proof is just like the proof of Theorem 3.4.3.) Chapter 3: Expectation 171 The
orem 3.4.9 Let X be any random variable with its first k moments finite. Then cX 0 In general, c k X 0 E X 2, etc. X is the kth derivative of cX. 1, cX 0 i k E X k, where i i 2 E X 2 1, and where c k i E X, cX 0 We also have the following. (The proof is just like the proof of Theorem 3.4.5.) Theorem 3.4.10 Let X and Y be random variables which are independent. Then cX Y s cX s cY s. For simplicity, we shall generally not use characteristic functions in this book. However, it is worth keeping in mind that whenever we do anything with moment­ generating functions, we could usually do the same thing in greater generality using characteristic functions. Summary of Section 3.4 X 0 The probability­generating function of a random variable X is rX t If X is discrete, then the derivatives of rX satisfy r k k! P X The kth moment of a random variable X is E X k. The moment­generating function of a random variable X is m X s rX es. The derivatives of m X satisfy m k If X and Y are independent, then rX Y t m X s mY s. If m X s is finite in a neighborhood of s distribution of X. The characteristic function cX s avoid infinities. E X k, for k 0 1 2 X 0 rX t rY y and m X Y s 0, then it uniquely characterizes the E t X. k. E es X. E ei s X can be used in place of m X s to EXERCISES 1 2 3 2.. 1 2z for. Use m X to prove that Var X.. Use mY to compute the mean and variance of Y. 1 and rZ 0 E Z and m Z 0 z P Z 3.4.1 Let Z be a discrete random variable with P Z (a) Compute rZ t. Verify that rZ 0 (b) Compute m Z t. Verify that m Z 0 3.4.2 Let X 3.4.3 Let Y 3.4.4 Let Y 3.4.5 Let Y 3.4.6 Let X 3.4.7 Let Y
3.4.8 Suppose P X (a) Compute rX t (b) Verify that rX 0 Binomial n Poisson 3X 3X Binomial n Poisson 4. Compute rY t 4. Compute mY s in terms of m X. in terms of rX. 1 and rX 0 1 2, P X 2P X P X for t R1. 2 5 2.. Compute E X 3, the third moment of X.. Compute E Y 3, the third moment of Y. 1 3, and P X 7 1 6. 172 Section 3.4: Generating Functions (c) Compute m X s for s (d) Verify that m X 0 R1. E X and m X 0 E X 2. PROBLEMS 10, with f X x 0 otherwise. E X (Hint: L’Hôpital’s rule.). Compute rX t and rX 0 2.. Compute rX t and rX 0 2.. x 1 10 for 0 R1. 3.4.9 Suppose f X x (a) Compute m X s for s (b) Verify that m X 0 3.4.10 Let X Geometric 3.4.11 Let X Negative­Binomial r 3.4.12 Let X Geometric (a) Compute m X s. (b) Use m X to compute the mean of X. (c) Use m X to compute the variance of X. 3.4.13 Let X Negative­Binomial r. (a) Compute m X s. (b) Use m X to compute the mean of X. (c) Use m X to compute the variance of X. 3.4.14 If Y and mY t 3.4.15 Let Z a eat m X bt N 2. Show that bX where a and b are constants, then show that rY t t arX t b m Z s exp s 2s2 2 X where X distribution in terms of N 0 1, and use Theorem 3.4.4.) (Hint: Write Z 3.4.16 Let Y be distributed according to the Laplace distribution (see Problem 2.4.22). (a) Compute mY s. (Hint: Break up the integral into two pieces.) (b) Use mY to compute the mean of
Y. (c) Use mY to compute the variance of Y. 3.4.17 Compute the kth moment of the Weibull Problem 2.4.19). 3.4.18 Compute the kth moment of the Pareto (Hint: Make the transformation u 3.4.19 Compute the kth moment of the Log­normal (Hint: Make the transformation z ln x and use Problem 3.4.15.) 3.4.20 Prove that the moment­generating function of the Gamma given by 3.4.21 Suppose that Xi generating functions, determine the distribution of Y 3.4.22 Suppose that Xi Negative­Binomial ri Using moment­generating functions, determine the distribution of Y 3.4.23 Suppose that Xi moment­generating functions, determine the distribution of Y Xn are independent. n i 1 Xi Xn are independent. Using n i 1 Xi 1 and recall the beta distribution.) distribution (see Problem 2.4.20). Poisson i and X1 distribution is t when t n i 1 Xi and X1 Gamma and X1 (see Xn are independent. Using moment­ distribution (see Problem 2.6.17). 1 x. i Chapter 3: Expectation 173 and N Poisson is i.i.d. Exponential are i.i.d. Exponential random variables and N independent 3.4.24 Suppose X1 X2 of the Xi. Determine the moment­generating function of SN Determine the first moment of this distribution by differentiating this function. 3.4.25 Suppose X1 X2 independent of the Xi. Determine the moment­generating function Geometric of SN Determine the first moment of this distribution by differentiating this function. 3.4.26 Let X 3.4.27 Let Y (a) Compute the characteristic function cY s. (Hint: Make use of cX s in Problem 3.4.26.) (b) Use cY s to compute the mean of Y. 3.4.28 The characteristic function of the Cauchy distribution (see Problem 2.4.21) is e t Use this to determine the characteristic function of the sample given by c t mean. Use cX s to compute the mean of X. Bernoulli Binomial n. X 1 n n Xi i 1 based on a sample of
n from the Cauchy distribution. Explain why this implies that the sample mean is also Cauchy distributed. What do you find surprising about this result? 3.4.29 The k­th cumulant (when it exists) of a random variable X is obtained by cal­ 0 and culating the k­th derivative of ln cX s with respect to s evaluating this at s dividing by i k Evaluate cX s and all the cumulants of the N 2 distribution. 3.5 Conditional Expectation We have seen in Sections 1.5 and 2.8 that conditioning on some event, or some random variable, can change various probabilities. Now, because expectations are defined in terms of probabilities, it seems reasonable that expectations should also change when conditioning on some event or random variable. Such modified expectations are called conditional expectations, as we now discuss. 3.5.1 Discrete Case The simplest case is when X is a discrete random variable, and A is some event of positive probability. We have the following. Definition 3.5.1 Let X be a discrete random variable, and let A be some event with P A 0. Then the conditional expectation of X given A, is equal to E X A x P X x A x R1 P X x A P A x x R1 EXAMPLE 3.5.1 Consider rolling a fair six­sided die, so that S 1 2 3 4 5 6. Let X be the number 174 Section 3.5: Conditional Expectation showing, so that X s 3, 5, or 6. What is E X A? s for s Here we know that S. Let A 3 5 6 be the event that the die shows or 6 1 3 and that, similarly. Hence R1 14 3 Often we wish to condition on the value of some other random variable. If the other random variable is also discrete, and if the conditioned value has positive probability, then this works as above. Definition 3.5.2 Let X and Y be discrete random variables, with P Y Then the conditional expectation of X given Y y, is equal to y 0 R1 x pX Y x y pY y x R1 EXAMPLE 3.5.2 Suppose the joint probability function of X and Y is given by pX otherwise 0 3 4 0 4 Then R1 5P 8P 29 Similarly
R1 5P X 5 Y 4 8P 13 2 Chapter 3: Expectation 175 Also 5P X 5 Y 3 x R1 1 7 1 7 5 5 Sometimes we wish to condition on a random variable Y, without specifying in ad­ vance on what value of Y we are conditioning. In this case, the conditional expectation E X Y is itself a random variable — namely, it depends on the (random) value of Y that occurs. Definition 3.5.3 Let X and Y be discrete random variables. Then the conditional expectation of X given Y, is the random variable E X Y which is equal to E X Y In particular, E X Y is a random variable that y when Y depends on the random value of Y. y. EXAMPLE 3.5.3 Suppose again that the joint probability function of X and Y is given by pX otherwise 0 3 4 0 4 We have already computed that E X Y E X Y 4 5. We can express these results together by saying that 29 4, E X Y 3 0 13 2, and E X Y 29 4 5 13 2 Y Y Y 0 3 4 That is, E X Y is a random variable, which depends on the value of Y. Note that, because P Y 0 3 4, the random variable E X Y is undefined in that case; but this is not a problem because that case will never occur. 0 for y y Finally, we note that just like for regular expectation, conditional expectation is linear. Theorem 3.5.1 Let X1 X2, and Y be random variables; let A be an event; let a b, and y be real numbers; and let Z (a) E Z A (b) E Z Y (c) E Z Y bE X2 A. y bE X2 Y. a E X1 A y a E X1 Y bX2. Then a E X1 Y bE X2 Y a X1 y. 176 Section 3.5: Conditional Expectation 3.5.2 Absolutely Continuous Case y, for some particular value of y, seems problematic, because P Y Suppose now that X and Y are jointly absolutely continuous. Then conditioning on Y 0. However, we have already seen in Section 2.8.2 that we can define a conditional density f X Y x y that gives us a density function for X, conditional on Y
y. And because density functions give rise to expectations, similarly conditional density functions give rise to conditional expectations, as follows. y Definition 3.5.4 Let X and Y be jointly absolutely continuous random variables, with joint density function f X Y x y. Then the conditional expectation of X given Y y, is equal to dx x R1 x f X Y x y fY y dx x R1 EXAMPLE 3.5.4 Let X and Y be jointly absolutely continuous, with joint density function f X Y given by f X Y x y 2y5 4x 2 y 0 0 x otherwise. 1 0 y 1 Then for 0 y 1, fY y f X Y x y dx 1 0 4x 2 y 2y5 dx 4y 3 2y5 Hence fY y dx 1 x 4x 2 y 4y 3 0 2y5 2y5 dx y5 2y5 1 4 3 y4 2y4 x R1 y 4y 3 As in the discrete case, we often wish to condition on a random variable without specifying in advance the value of that variable. Thus, E X Y is again a random variable, depending on the random value of Y. Definition 3.5.5 Let X and Y be jointly absolutely continuous random variables. Then the conditional expectation of X given Y, is the random variable E X Y which is equal to E X Y y when Y that depends on the random value of Y. y. Thus, E X Y is a random variable EXAMPLE 3.5.5 Let X and Y again have joint density f X Y x y 2y5 4x 2 y 0 0 x otherwise. 1 0 y 1 Chapter 3: Expectation 177 4 3 We already know that E X Y for any y between 0 and 1, so we conclude that E X Y Note that in this last formula, Y is a random variable, so E X Y is also a random variable. 2y4 This formula is valid 2Y 4 4 3 Y 4 y4 1 1 y Finally, we note that in the absolutely continuous case, conditional expectation is still linear, i.e., Theorem 3.5.1 continues to hold. 3.5.3 Double Expectations Because the conditional expectation E X Y is itself a random variable (as a function of Y ), it makes sense to take its expectation, E E X Y. This is a double expectation. One of the key results
about conditional expectation is that it is always equal to E X. Theorem 3.5.2 (Theorem of total expectation) If X and Y are random variables, then E E X Y E X. This theorem follows as a special case of Theorem 3.5.3 on the next page. But it also makes sense intuitively. Indeed, conditioning on Y will change the conditional value of X in various ways, sometimes making it smaller and sometimes larger, de­ pending on the value of Y. However, if we then average over all possible values of Y, these various effects will cancel out, and we will be left with just E X. EXAMPLE 3.5.6 Suppose again that X and Y have joint probability function pX otherwise 0 3 4 0 4 E X Y y 29 4 5 13 2 y y y 0 3 4 Then we know that Also. Hence, 3 7 4 7, P Y 3 1 7, and R1 E X Y 29 13 2 2 7 47 178 Section 3.5: Conditional Expectation On the other hand, we compute directly that E X 5 3 7 47 7. Hence, E E X Y 8 4 7 5P X E X, as claimed. 5 8P X 8 EXAMPLE 3.5.7 Let X and Y again have joint density f X Y x y 2y5 4x 2 y 0 0 x otherwise. 1 0 y 1 We already know that E X Y 1 Y 4 4 3 2Y 4 and that fY y 4y 3 2y5 for 0 y 1. Hence On the other hand, Y 4 2Y 4 y4 2y4 4y 3 E X Y y fY y dy 2y5 dy 1 0 y y5 dy dy d x 0 Hence, E E X Y 1 x 2x 2 2 6 dx 1 0 2x 3 E X, as claimed. 1 1 0 0 x 4x 2 y 2y5 dy d x x 3 dx 2 4 1 6 2 3 Theorem 3.5.2 is a special case (with g y 1) of the following more general result, which in fact characterizes conditional expectation. Theorem 3.5.3 Let X and Y be random variables, and let g : R1 function. Then R1 be any PROOF See Section 3.8 for the proof of this result. We also note the following related result. It says that, when conditioning on Y, any function of Y can
be factored out since it is effectively a constant. Theorem 3.5.4 Let X and Y be random variables, and let g : R1 function. Then. R1 be any PROOF See Section 3.8 for the proof of this result. Finally, because conditioning twice on Y is the same as conditioning just once on Y, we immediately have the following. Theorem 3.5.5 Let X and Y be random variables. Then E E X Y Y E X Y. Chapter 3: Expectation 179 3.5.4 Conditional Variance (Advanced) In addition to defining conditional expectation, we can define conditional variance. As usual, this involves the expected squared distance of a random variable to its mean. However, in this case, the expectation is a conditional expectation. In addition, the mean is a conditional mean. Definition 3.5.6 If X is a random variable, and A is an event with P A the conditional variance of X given A, is equal to 0, then Var Similarly, if Y is another random variable, then Var and Var EXAMPLE 3.5.8 Consider again rolling a fair six­sided die, so that S 1 6 and X s s A P X A, and that E X A s for s 1 3 for s S, and with A 1 2 3 4 5 6, with P s 3 5 6. We have already computed that 14 3. Hence, Var 14 3 2 A s 14 3 2 P X s A 3 14 3 2 1 3 5 s S 14 3 2 1 3 6 14 3 2 1 3 14 9 1 56 By contrast, because E X 7 2, we have Var 35 12 2 92 Hence, we see that the conditional variance Var X A is much smaller than the uncon­ ditional variance Var X. This indicates that, in this example, once we know that event A has occurred, we know more about the value of X than we did originally. EXAMPLE 3.5.9 Suppose X and Y have joint density function f X Y x y 8x y 0 0 y x otherwise. 1 We have fY y 4y3, f X Y x y 8x y 4y3 2x y2 for 0 x y and so E X Y y y 0 x 2x y2 dx y 2x 2 y2 dx 0 2y3 3y2 2y 3 180 Therefore, Section
3.5: Conditional Expectation Var 2y 3 2 2x y2 dx 1 2y2 8 9y 4 9 Finally, we note that conditional expectation and conditional variance satisfy the following useful identity. Theorem 3.5.6 For random variables X and Y, Var X Var E X Y E Var X Y PROOF See Section 3.8 for the proof of this result. Summary of Section 3.5 x A. y when Y x R1 x P X If X is discrete, then the conditional expectation of X given an event A is equal to E X A If X and Y are discrete random variables, then E X Y is itself a random vari­ able, with E X Y equal to E X Y If X and Y are jointly absolutely continuous, then E X Y is itself a random variable, with E X Y equal to dx. Conditional expectation is linear. We always have that E g Y E X Y E X Y. Conditional variance is given by Var X Y E g Y X, and E E X Y Y y where E X Y E X Y 2. y when Y E X 2 Y y. EXERCISES 3.5.1 Suppose X and Y are discrete, with pX otherwise 3 2 3 2 17 (a) Compute E X Y (b) Compute E Y X (c) Compute E X Y. (d) Compute E Y X. 3. 3. Chapter 3: Expectation 181 3.5.2 Suppose X and Y are jointly absolutely continuous, with y5 16 000 900 0 x otherwise 4 0 y 5 (a) Compute f X x. (b) Compute fY y. (c) Compute E X Y. (d) Compute E Y X. (e) Compute E E X Y, and verify that it is equal to E X. 3.5.3 Suppose X and Y are discrete, with pX Y x y 1 11 2 11 4 11 1 11 1 11 1 11 1 11 otherwise 2 3 7 2 3 7 13 4. 6. (a) Compute E Y X (b) Compute E Y X (c) Compute E Y X. 3.5.4 Let pX Y be as in the previous exercise. (a) Compute E X Y (b) Compute E X Y (c) Compute E X Y (d) Compute E X Y (e) Compute
E X Y. 3.5.5 Suppose that a student must choose one of two summer job offers. If it is not nec­ essary to take a summer course, then a job as a waiter will produce earnings (rounded to the nearest $1000) with the following probability distribution. 2. 3. 7. 13. $1000 0 1 $2000 0 3 $3000 0 4 $4000 0 2 If it is necessary to take a summer course, then a part­time job at a hotel will produce earnings (rounded to the nearest $1000) with the following probability distribution. $1000 0 3 $2000 0 4 $3000 0 2 $4000 0 1 If the probability that the student will have to take the summer course is 0 6, then determine the student’s expected summer earnings. 3.5.6 Suppose you roll two fair six­sided dice. Let X be the number showing on the first die, and let Z be the sum of the two numbers showing. 182 Section 3.5: Conditional Expectation. 11. 1 if the first coin shows heads, otherwise Y (a) Compute E X. (b) Compute E Z X (c) Compute E Z X (d) Compute E X Z (e) Compute E X Z (f) Compute E X Z (g) Compute E X Z (h) Compute E X Z 3.5.7 Suppose you roll two fair six­sided dice. Let Z be the sum of the two numbers showing, and let W be the product of the two numbers showing. (a) Compute E Z W 4. (b) Compute E W Z 4. 3.5.8 Suppose you roll one fair six­sided die and then ip as many coins as the number showing on the die. (For example, if the die shows 4, then you ip four coins.) Let X be the number showing on the die, and Y be the number of heads obtained. (a) Compute E Y X (b) Compute E X Y (c) Compute E X Y 3.5.9 Suppose you ip three fair coins. Let X be the number of heads obtained, and let Y (a) Compute E X Y (b) Compute E X Y (c) Compute E Y X (d) Compute E Y X (e) Compute
E Y X (f) Compute E Y X (g) Compute E Y X. (h) Verify directly that E[E Y X ] E Y. 3.5.10 Suppose you ip one fair coin and roll one fair six­sided die. Let X be the 0 if the coin is number showing on the die, and let Y tails. Let Z X Y. (a) Compute E Z. (b) Compute E Z X (c) Compute E Y X (d) Compute E Y Z (e) Compute E X Z 3.5.11 Suppose X and Y are jointly absolutely continuous, with joint density function f X Y x y 0. (a) Compute E X. (b) Compute E Y. (c) Compute E X Y. (d) Compute E Y X. (e) Verify directly that E[E X Y ] (f) Verify directly that E[E Y X ] 1 if the coin is heads with Y 1, otherwise 19 x 2 y3 for 0 2 and 0 0. x y Chapter 3: Expectation 183 PROBLEMS 3.5.12 Suppose there are two urns. Urn I contains 100 chips: 30 are labelled 1, 40 are labelled 2, and 30 are labelled 3. Urn 2 contains 100 chips: 20 are labelled 1, 50 are labelled 2, and 30 are labelled 3. A coin is tossed and if a head is observed, then a chip is randomly drawn from urn 1, otherwise a chip is randomly drawn from urn 2. The value Y on the chip is recorded. If an occurrence of a head on the coin is denoted by X then determine 1, a tail by X E X Y E Y X E Y and E X 3.5.13 Suppose that five coins are each tossed until the first head is obtained on each coin and where each coin has probability of producing a head. If you are told that the total number of tails observed is Y 10 then determine the expected number of tails observed on the first coin. 3.5.14 (Simpson’s paradox) Suppose that the conditional distributions of Y given X are shown in the following table. For example, pY X 1 i could correspond to the probability that a randomly selected heart patient at hospital i has a successful treat­ ment. Bernoulli 3 4 0 and X
pY X 0 1 0 030 pY X 0 2 0 020 pY X 1 1 0 970 pY X 1 2 0 980 (a) Compute E Y X (b) Now suppose that patients are additionally classified as being seriously ill (Z or not seriously ill (Z shown in the following tables. Compute E Y X Z 1), 0). The conditional distributions of Y given X Z, are pY X Z 0 1 0 0 010 pY X Z 0 2 0 0 013 pY X Z 1 1 0 0 990 pY X Z 1 2 0 0 987 pY X Z 0 1 1 0 038 pY X Z 0 2 1 0 040 pY X Z 1 1 1 0 962 pY X Z 1 2 1 0 960 (c) Explain why the conditional distributions in part (a) indicate that hospital 2 is the better hospital for a patient who needs to undergo this treatment, but all the conditional distributions in part (b) indicate that hospital 1 is the better hospital. This phenomenon is known as Simpson’s paradox. (d) Prove that, in general, pY X y x z pY X Z y x z pZ X z x and e) If the conditional distributions pZ X corresponding to the example discussed x in parts (a) through (c) are given in the following table, verify the result in part (d) 184 Section 3.6: Inequalities numerically and explain how this resolves Simpson’s paradox. pZ X 0 1 0 286 pZ X 0 2 0 750 pZ X 1 1 0 714 pZ X 1 2 0 250 2 1 2 1 0, s, and Determine E X 1 2 3 with X s y and that the marginal Var X. (Hint: Suppose S y and its analog (when given X. Use (2.7.1) (when x to determine E X Y, E Y X, y, is distributed Gamma Exponential Bivariate Normal 3.5.15 Present an example of a random variable X, and an event A with P A such that Var X A A 1 3.) 3.5.16 Suppose that X, given Y distribution of Y is given by 1 Y 3.5.17 Suppose that X Y given Y Var X Y and Var Y X 3.5.18 Suppose that X1 X2 X3 Multinomial n and Var X1
X2. (Hint: Show that X1 given X2 3.5.19 Suppose that X1 X2 Var X1 X2 tribution and then use Problem 3.3.24.) 3.5.20 Let f X Y be as in Exercise 3.5.2. (a) Compute Var X. (b) Compute Var E X Y. (c) Compute Var X Y. (d) Verify that Var X 3.5.21 Suppose we have three discrete random variables X Y and Z We say that X and Y are conditionally independent, given Z if 3. Determine E X1 X2 and x2 has a beta dis­ given X2 Dirichlet (Hint: First show that X1 1 x2 has a binomial distribution.) 3. Determine E X1 X2 E Var X Y. Var E X Y x2 1 1 2 2 pX Y Z x y z pX Z x z pY Z y z for every x y and z such that P Z ally independent, given Z then z 0 Prove that when X and Y are condition.6 Inequalities Expectation and variance are closely related to the underlying distributions of random variables. This relationship allows us to prove certain inequalities that are often very useful. We begin with a classic result, Markov’s inequality, which is very simple but also very useful and powerful. Chapter 3: Expectation 185 Theorem 3.6.1 (Markov’s inequality) If X is a nonnegative random variable, then for all a 0, P X a E X a That is, the probability that X exceeds any given value a is no more than the mean of X divided by a. PROOF Define a new random variable Z by Z a 0 X X a a Then clearly Z X, so that E Z E X by monotonicity. On the other hand So, E X E Z a P X a. Rearranging, P X a E X a, as claimed. Intuitively, Markov’s inequality says that if the expected value of X is small, then it is unlikely that X will be too large. We now consider some applications of Theorem 3.6.1. EXAMPLE 3.6.1 Suppose, P X 4 1 3, and P X 7 1 6. Then E X 7 1 6 2 3. In fact, P X 4. Hence,
setting a 1 6 6 6, Markov’s inequality says that 2 3. EXAMPLE 3.6.2 Suppose P X Hence, setting. Then E X 8, Markov’s inequality says that P X 5 8. 5. In fact, EXAMPLE 3.6.3 Suppose P X Hence, setting, Markov’s inequality says that P X 2 1 2, so Markov’s inequality is an equality in this case. 1 2. Then E X 2 2 1 2 1 2. 1. In fact, Markov’s inequality is also used to prove Chebychev’s inequality, perhaps the most important inequality in all of probability theory. Theorem 3.6.2 (Chebychev’s inequality) Let Y be an arbitrary random variable, with finite mean Y. Then for all a 0, P Y Y a Var Y a2 PROOF Set X Theorem 3.6.1, we have P Y and this establishes the result Y Y 2. Then X is a nonnegative random variable. Thus, using E X a2 Var Y a2 P X a2 a Y 186 Section 3.6: Inequalities Intuitively, Chebychev’s inequality says that if the variance of Y is small, then it Y. We now consider some is unlikely that Y will be too far from its mean value examples. 3 4 as above. Also, E X 2 18 EXAMPLE 3.6.4 Suppose again that P X Then E X that Var X that P X 4 P X 2 32 2 9, which is true because in fact P X 1 1. On the other hand, setting a 4 2. Hence, setting a 2 12 4 1 42 1 2, P X 4 9 1 2 1 6. 18, so 49 1 6 1, Chebychev’s inequality says 2, which tells us nothing because we always have 1 3, and P X 16 1 3 7 3, we get. EXAMPLE 3.6.5 1 9. Hence, 5. Then E X Let X Exponential 3, and let a 1 2 2 4 9. 1 2, P X 1 3 by Chebychev’s inequality with a 5 6, and 0, P X On the other hand, because X by Markov’s inequality, P X 4 9, we 1 3 actually get a better bound from Mark
ov’s inequality than from Chebychev’s inequality in this case. 1 2 1 2 2 5. Because 2 5 1 3 and Var EXAMPLE 3.6.6 Let Z N 0 1, and a 5. Then by Chebychev’s inequality, P Z 5 1 5. EXAMPLE 3.6.7 Let X be a random variable having very small variance. Then Chebychev’s inequality a is small whenever a is not too small. In other words, usually says that P X X. This makes sense, because if the variance of X X is very small, then usually X is very close to its mean value X X is very small, i.e., X X. Inequalities are also useful for covariances, as follows. Theorem 3.6.3 (Cauchy–Schwartz inequality) Let X and Y be arbitrary random variables, each having finite, nonzero variance. Then Cov X Y Var X Var Y Furthermore, if Var Y 0, then equality is attained if and only if X X Y Y where Cov X Y Var Y. PROOF See Section 3.8 for the proof. The Cauchy–Schwartz inequality says that if the variance of X or Y is small, then the covariance of X and Y must also be small. EXAMPLE 3.6.8 Suppose X Schwartz inequality that, for any random variable Y, we must have Cov X Y Var X Var Y 1 2 C is a constant. Then Var X 0 so that Cov X Y 0 Var Y 1 2 It follows from the Cauchy– 0. 0. Chapter 3: Expectation 187 Recalling that the correlation of X and Y is defined by Corr X Y Cov X Y Var X Var Y we immediately obtain the following important result (which has already been referred to, back when correlation was first introduced). Corollary 3.6.1 Let X and Y be arbitrary random variables, having finite means and finite, nonzero variances. Then Corr X Y 1 if and only if 1 Furthermore, Corr X Y X X Cov X Y Var Y Y Y So the correlation between two random variables is always between also see that X and Y are linearly related if and only if Corr X Y this relationship is increasing (positive slope) when Corr X Y (negative
slope) when Corr X Y 1 1 and 1. We 1 and that 1 and decreasing 3.6.1 Jensen’s Inequality (Advanced) Finally, we develop a more advanced inequality that is sometimes very useful. A func­ tion f is called convex if for every x lies entirely above the graph of f as depicted in Figure 3.6.1. y, the line segment from x f x to y f y 600 f 500 400 300 200 100 2 3 4 5 x Figure 3.6.1: Plot of the convex function f x 4 f 4. x 4 and the line segment joining 2 f 2 to In symbols, we require that for every x 1 x 2, f x f y f x 4, and f x x 1 f x f x following. y and every 0 1, we have y. Examples of convex functions include max x C for any real number C. We have the Theorem 3.6.4 (Jensen’s inequality) Let X be an arbitrary random variable, and let f : R1 E f X R1 be a convex function such that E f X is finite. Then f E X Equality occurs if and only if f X bX for some a and b a 188 Section 3.6: Inequalities PROOF Because f is convex, we can find a linear function g x that g E X 3.6.2). f E X and g x f x for all x b such R1 (see, for example, Figure ax 250 f 200 150 100 50 0 2.5 3.0 3.5 4.0 x Figure 3.6.2: Plot of the convex function f x g x 3 satisfying g x 108 x 81 x 4 and the function f x on the interval 2 4 But then using monotonicity and linearity, we have We have equality if and only if 0 a E X b f E X as claimed. E f X g X this occurs (using Challenge 3.3.29) if and only if f X probability 1. Because f X g X g X 0 b with a X EXAMPLE 3.6.9 Let X be a random variable with finite variance. Then setting f x inequality says that E X 2 E X 2 Var X E X 2 x 2, Jensen’s E X 2. Of course, we already knew this because 0. EXAM
PLE 3.6.10 Let X be a random variable with finite fourth moment. Then setting f x Jensen’s inequality says that E X 4 E X 4. x 4, EXAMPLE 3.6.11 Let X be a random variable with finite mean, and let M R1. Then setting f x max x M, we have that E max X M max E X M by Jensen’s inequality. In fact, we could also have deduced this from the monotonicity property of expectation, using the two inequalities max X M X and max X M M. Summary of Section 3.6 For nonnegative X Markov’s inequality says P X Chebychev’s inequality says P Y The Cauchy–Schwartz inequality says Cov X Y that Corr X Y 1. a Y E X a. a Var Y a2. Var X Var Y 1 2, so Chapter 3: Expectation 189 Jensen’s inequality says f E X E f X whenever f is convex. EXERCISES 1 1. 10. 30. 9. 2. N 0 100, and let Z 3 and compare it with the precise value. Binomial 80 1 4. Determine (with explana­ Poisson 3. Use Markov’s inequality to get an upper bound on P Z N 5 9. Use Chebychev’s inequality to get an upper bound on P Z Exponential 5. Use Markov’s inequality to get an upper bound on Geometric 1 11. Use Jensen’s inequality to determine a lower bound 3.6.1 Let Z 7. 3.6.2 Let X P X 3.6.3 Let X Geometric 1 2. (a) Use Markov’s inequality to get an upper bound on P X (b) Use Markov’s inequality to get an upper bound on P X (c) Use Chebychev’s inequality to get an upper bound on P X (d) Compare the answers obtained in parts (b) and (c). 3.6.4 Let Z 5 3.6.5 Let W Binomial 100 1 2, as in the number of heads when ipping 100 fair coins. Use Chebychev’s inequality to get an upper bound on P W 50 3.6.6 Let Y tion) the largest and smallest possible values of Cov Y Z
. 3.6.7 Let X on E X 4, in two different ways. (a) Apply Jensen’s inequality to X with f x (b) Apply Jensen’s inequality to X 2 with f x 3.6.8 Let X be the number showing on a fair six­sided die. What bound does Cheby­ chev’s inequality give for P X 3.6.9 Suppose you ip four fair coins. Let Y be the number of heads obtained. (a) What bound does Chebychev’s inequality give for P Y (b) What bound does Chebychev’s inequality give for P Y 3.6.10 Suppose W has density function f f 0. (a) Compute E W. (b) What bound does Chebychev’s inequality give for P W E W 3.6.11 Suppose Z has density function f z 0. (a) Compute E Z. (b) What bound does Chebychev’s inequality give for P Z 3.6.12 Suppose Var X (a) What is the largest possible value of Cov X Y? (b) What is the smallest possible value of Cov X Y? (c) Suppose Z with part (a). (d) Suppose W answer with part (b). 3X 2. Compute Var Z and Cov X Z, and compare your answer 3X 2. Compute Var W and Cov X W, and compare your 2, otherwise f z 3 or Y 4 or Y 1, otherwise 3 2 for 0 4 and Var Y z3 4 for 0 x 4. x 2. 1? 0? 5 or. z 190 Section 3.6: Inequalities 3.6.13 Suppose a species of beetle has length 35 millimeters on average. Find an upper bound on the probability that a randomly chosen beetle of this species will be over 80 millimeters long. PROBLEMS and Var X 0, there is a 0, there is a positive integer M, such that if X 3.6.14 Prove that for any 0 and. is the number of heads when ipping M fair coins, then P X M and 2 0 and a random variable X with 3.6.15 Prove that for any 2, such that Chebychev’s inequality holds with equality, E X i.e., such that P X 3.6.16 Suppose that X Y is
uniform on the set xn are distinct values and the y1 x1 (a) Prove that X is uniformly distributed on x1 n n 1 i 1 xi (b) Prove that the correlation coefficient between X and Y is given by x1 y1 yn are distinct values. n i 1 xi and variance given by s2 X xn with mean given by x xn yn where the 2 a2. n 1 x 2 1 2 a rXY n i 1 xi x n i 1 xi x 2 y yi n i 1 yi sXY sX sY y 2 n 1 n i 1 xi x 1 1 yi n 1 n i 1 xi xn and so has mean x n i 1 xi and variance s2 X x 2 (see Problem 3.6.16(a)) What is 1 and state the conditions under which rXY xn yn are an observed sample from some bivariate distribution. y The value sXY is referred to as the sample where sXY covariance and rXY is referred to as the sample correlation coefficient when the values x1 y1 (c) Argue that rXY is also the correlation coefficient between X and Y when we drop the assumption of distinctness for the xi and yi. (d) Prove that rXY 3.6.17 Suppose that X is uniformly distributed on x1 n 1 the largest proportion of the values xi that can lie outside x 3.6.18 Suppose that X is distributed with density given by f X x and is 0 otherwise. (a) Prove that f X is a density. (b) Calculate the mean of X (c) Compute P X by Markov’s inequality. (d) What does Chebyshev’s inequality say in this case? 3.6.19 Let g x x (a) Verify that g is a convex function. (b) Suppose Z E g Z. 3.6.20 It can be shown that a function f with continuous second derivative, is convex on a b if f a b (a) Use the above fact to show that f x Exponential 5. Use Jensen’s inequality to obtain a lower bound on k and compare this with the upper bound on this quantity given 2sX? 2 x 3 for x x p is convex on 0
whenever p 0 for all x 2sX x max 10. 1 x 1 Chapter 3: Expectation 191 (b) Use part (a) to prove that E X p (c) Prove that Var X 1 0 if and only if X is degenerate at a constant c E X whenever p 1 p CHALLENGES 3.6.21 Determine (with proof) all functions that are convex and whose negatives are also convex. is convex.) (That is, find all functions f such that is convex, and also f f 3.7 General Expectations (Advanced) So far we have considered expected values separately for discrete and absolutely con­ tinuous random variables only. However, this separation into two different “cases” may seem unnatural. Furthermore, we know that some random variables are neither discrete nor continuous — for example, mixtures of discrete and continuous distributions. Hence, it seems desirable to have a more general definition of expected value. Such generality is normally considered in the context of general measure theory, an advanced mathematical subject. However, it is also possible to give a general definition in ele­ mentary terms, as follows. Definition 3.7.1 Let X be an arbitrary random variable (perhaps neither discrete nor continuous). Then the expected value of X is given by E X P X t dt P X t dt 0 0 provided either 0 P X t dt or 0 P X t dt This definition appears to contradict our previous definitions of E X. However, in fact, there is no contradiction, as the following theorem shows. Theorem 3.7.1 (a) Let X be a discrete random variable with distinct possible values x1 x2 and put pi P X of E X. That is, xi. Then Definition 3.7.1 agrees with the previous definition P X t dt P X t dt 0 0 xi pi i (b) Let X be an absolutely continuous random variable with density f X. Then Definition 3.7.1 agrees with the previous definition of E X. That is, P X t dt P X t dt x f X x dx 0 0 PROOF The key to the proof is switching the order of the integration
/summation. 192 (a) We have Section 3.7: General Expectations (Advanced) P X t dt 0 pi dt 0 i xi t xi 0 dt pi i pi xi i as claimed. (b) We have P X t dt 0 Similarly, 0 P X t dt Hence, 0 0 0 0 f X x dx dt t x 0 0 f X x dt dx x f X x dx t f X x dx dt 0 0 x f X x dt dx x f X x dx P X t dt P X t dt 0 0 0 x f X x dx x f X x dx 0 x f X x dx as claimed. In other words, Theorem 3.7.1 says that Definition 3.7.1 includes our previous defi­ nitions of expected value, for both discrete and absolutely continuous random variables, while working for any random variable at all. (Note that to apply Definition 3.7.1 we take an integral, not a sum, regardless of whether X is discrete or continuous!) Furthermore, Definition 3.7.1 preserves the key properties of expected value, as the following theorem shows. (We omit the proof here, but see Challenge 3.7.10 for a proof of part (c).) Theorem 3.7.2 Let X and Y be arbitrary random variables, perhaps neither discrete nor continuous, with expected values defined by Definition 3.7.1. (a) (Linearity) If a and b are any real numbers, then E a X bY (b) If X and Y are independent, then E XY (c) (Monotonicity) If X Y, then bE Y Definition 3.7.1 also tells us about expected values of mixture distributions, as fol­ lows. Chapter 3: Expectation 193 i k, let Yi be a random variable with cdf Fi. Let X be Theorem 3.7.3 For 1 a random variable whose cdf corresponds to a finite mixture (as in Section 2.5.4) of the cdfs of the Yi, so that FX x 1. Then E X i pi Fi x where pi 0 and i pi i pi E Yi PROOF We compute that P X t 1 FX
t 1 pi Fi t i pi 1 Fi t pi P Yi t Similarly, i P X t FX t pi Fi t i Hence, from Definition 3.7.1, i i pi P Yi t E X P X t dt P X t dt 0 pi P Yi t dt pi P Yi t dt 0 i 0 P Yi t dt P Yi t dt 0 0 i i i pi 0 pi E Yi as claimed. Summary of Section 3.7 t dt 0 P X For general random variables, we can define a general expected value by E X 0 P X This definition agrees with our previous one, for discrete or absolutely continu­ ous random variables. General expectation is still linear and monotone. t dt. EXERCISES 3.7.1 Let X1, X2, and Y be as in Example 2.5.6, so that Y is a mixture of X1 and X2. Compute E X1, E X2, and E Y. 3.7.2 Suppose we roll a fair six­sided die. If it comes up 1, then we roll the same die again and let X be the value showing. If it comes up anything other than 1, then we 194 Section 3.8: Further Proofs (Advanced) C. C for some constant 0. Prove directly from Definition 3.7.1 that E X instead roll a fair eight­sided die (with the sides numbered 1 through 8), and let X be the value showing on the eight­sided die. Compute the expected value of X. 3.7.3 Let X be a positive constant random variable, so that X C 3.7.4 Let Z be a general random variable (perhaps neither discrete nor continuous), and suppose that P Z 100. 3.7.5 Suppose we are told only that P X for x 3.7.6 Suppose P Z P Z 0 for z 3.7.7 Suppose P W Compute E W. 1 1, but we are not told if X is discrete or continuous or neither. Compute E X. 8, and z 1 for z 8. Compute E Z. for 1. Prove directly from Definition 3.7.1 that E Z 1 x 2 for x 0 and P W 1, and P X z 3 for 5 5,
P Z 1 for e 5 100 0. 8 x x z z z e y2 2 for y y 3.7.8 Suppose P Y E Y. (Hint: The density of a standard normal might help you solve the integral.) 3.7.9 Suppose the cdf of W is given by FW 11, and by FW for 10 P W that FW 10 10, FW 11. Compute E W. (Hint: Remember 0. Compute 0 and P Y 1 for y 0 for P W 1 for.) 1 y CHALLENGES 3.7.10 Prove part (c) of Theorem 3.7.2. (Hint: If X X P Y t compare to the event Y t? And what about X t and Y t?) t? Hence, how does P X Y, then how does the event t compare to 3.8 Further Proofs (Advanced) Proof of Theorem 3.4.7 We want to prove that if S has a compound distribution as in (3.4.2), then (a) E S E X1 E N and (b) m S s rN m X1 s. Because the Xi are i.i.d., we have E Xi I 1 N i. Then we can write S i 1 Xi Ii Also note that E X1 for all i. Define Ii by Ii i 1 Ii N. Because N is independent of Xi, so is Ii and we have E S E Xi Ii E Xi Ii i 1 i 1 E Xi E Ii E X1 E Ii i 1 i 1 E X1 E Ii E X1 E i 1 E X1 E N Ii i 1 Chapter 3: Expectation This proves part (a). 195 Now, using an expectation version of the law of total probability (see Theorem m X1 s n because the Xi are i.i.d., n i 1 s Xi 3.5.3), and recalling that E exp we compute that m S s E exp n i 1 s Xi P N n E exp n 0 n i 1 s Xi rN m X1 s n 0 E m X 1 s N thus proving part (b). P N n E exp n i 1 s Xi Proof of Theorem 3.5.3 We want to show that when X and Y are random variables, and g : R1 function, then R1 is any If
X and Y are discrete, then R1 R1 x R1 g y x y R1 x R1 R1 y R1 as claimed. Similarly, if X and Y are jointly absolutely continuous, then fY y dy dx fY y dy x f X Y x y fY y dx fY y dy g y x f X Y x y dx dy E g Y X as claimed. 196 Section 3.8: Further Proofs (Advanced) Proof of Theorem 3.5.4 We want to prove that, when X and Y are random variables, and g : R1 function, then R1 is any For simplicity, we assume X and Y are discrete; the jointly absolutely continuous y case is similar. Then for any y with P Y 0 R1 z R1 g y x P X x Y x R1 g y x R1. Because this is true for any y, we must have E g Y X Y claimed. g Y E X Y, as Proof of Theorem 3.5.6 We need to show that for random variables X and Y, Var X E Var X Y Var E X Y Using Theorem 3.5.2, we have that Var 3.8.1) Now3.8.2) X 2 X But E X E X Y 2 Y Also, again using Theorem 3.5.2, Var Var E X Y Finally, using Theorem 3.5.4 and linearity (Theorem 3.5.1), we see that From (3.8.1), (3.8.2), and linearity, we have that Var X E Var X Y Var E X Y 0 which completes the proof. Chapter 3: Expectation 197 Proof of Theorem 3.6.3 (Cauchy–Schwartz inequality) We will prove that whenever X and Y are arbitrary random variables, each having finite, nonzero variance, then Cov X Y Var X Var Y Furthermore, if Var Y 0, then equality is attained if and only if X X Y Y where If Var Y (because Var Y Cov X Y Var Y. 0 then Challenge 3.3.30 implies that Y 0). This implies that E Y 2 Y Y with probability 1 Cov X Y E X X Y Y 0 Var X Var Y and the Cauchy–Schwartz inequality holds. 0 let Z If Var Y X X and W Y Y. Then for any real number
, we compute, using linearity, that Var X a 2 b 2 Cov X Y 2 Var Y c Var Y where a clearly E Z always nonnegative, and so has at most one real root. 2 Cov X Y, and c 0 for all W 2 0 b Var X. On the other hand,. Hence, we have a quadratic equation that is By the quadratic formula, any quadratic equation has two real roots provided that 0. Because that is not the case here, we must have 4ac the discriminant b2 b2 0, i.e., 4ac 4 Cov X Y 2 4 Var Y Var X 0 Dividing by 4, rearranging, and taking square roots, we see that Cov X Y Var X Var Y 1 2 as claimed. Finally, Cov X Y Var X Var Y 1 2 if and only if b2 4ac means the quadratic has one real root. Thus, there is some real number W 2 W 2 E Z happens if and only if Z case, then 0, which such that 0, it follows from Challenge 3.3.29 that this W 0 with probability 1, as claimed. When this is the 0. Since Z Cov Var Y and so Cov X Y Var Y when Var Y 0. Chapter 4 Sampling Distributions and Limits CHAPTER OUTLINE Section 1 Sampling Distributions Section 2 Convergence in Probability Section 3 Convergence with Probability 1 Section 4 Convergence in Distribution Section 5 Monte Carlo Approximations Section 6 Normal Distribution Theory Section 7 Further Proofs (Advanced) In many applications of probability theory, we will be faced with the following prob­ Xn is an identically and independently distributed lem. Suppose that X1 X2 Xn is a sample from some distribution, and we (i.i.d.) sequence, i.e., X1 X2 are interested in the distribution of a new random variable Y Xn for some function h In particular, we might want to compute the distribution function of Y or perhaps its mean and variance. The distribution of Y is sometimes referred to as its sampling distribution, as Y is based on a sample from some underlying distribution. We will see that some of the methods developed in earlier chapters are useful in solving such problems — especially when it is possible to compute an exact solution, e.g., obtain an exact expression for the probability or density function of Y Section 4.6 contains a number of exact distribution results for a variety of functions
of normal random variables. These have important applications in statistics. h X1 X2 Quite often, however, exact results are impossible to obtain, as the problem is just too complex. In such cases, we must develop an approximation to the distribution of Y For many important problems, a version of Y is defined for each sample size n (e.g., a sample mean or sample variance), so that we can consider a sequence of random variables Y1 Y2 etc. This leads us to consider the limiting distribution of such a sequence so that, when n is large, we can approximate the distribution of Yn by the 199 200 Section 4.1: Sampling Distributions limit, which is often much simpler. This approach leads to a famous result, known as the central limit theorem, discussed in Section 4.4. Sometimes we cannot even develop useful approximations for large n due to the difficulty of the problem or perhaps because n is just too small in a particular applica­ tion. Fortunately, however, we can then use the Monte Carlo approach where the power of the computer becomes available. This is discussed in Section 4.5. In Chapter 5 we will see that, in statistical applications, we typically do not know much about the underlying distribution of the Xi from which we are sampling. We then collect a sample and a value, such as Y that will serve as an estimate of a characteristic of the underlying distribution, e.g., the sample mean X will serve as an estimate of the mean of the distribution of the Xi We then want to know what happens to these estimates as n grows. If we have chosen our estimates well, then the estimates will converge to the quantities we are estimating as n increases. Such an estimate is called consistent. In Sections 4.2 and 4.3, we will discuss the most important consistency theorems — namely, the weak and strong laws of large numbers. 4.1 Sampling Distributions Let us consider a very simple example. EXAMPLE 4.1.1 Suppose we obtain a sample X1 X2 of size n probability function given by 2 from the discrete distribution with pX otherwise Let us take Y2 geometric mean of n positive numbers x1 1 2 This is the geometric mean of the sample values (the xn is defined as x1 X1 X2 1 n). xn To determine the distribution of Y2 we first list the possible values for Y2
the samples that give rise to these values, and their probabilities of occurrence. The values of these probabilities specify the sampling distribution of Y We have the following table. y 1 2 3 2 6 3 Sample pY2 16 1 8 1 16 Now suppose instead we have a sample X1 find the distribution of Y20 X20 but this time the computations are much more complicated, as there are now 320 3,486,784,401 possible samples, as opposed to the 32 9 samples used to form the X1 20 and we want to 1 20 Obviously, we can proceed as above, X20 of size n Chapter 4: Sampling Distributions and Limits 201 previous table. Directly computing pY20, as we have done for pY2, would be onerous — even for a computer! So what can we do here? One possibility is to look at the distribution of Yn 1 n when n is large and see if we can approximate this in some fashion. The results of Section 4.4.1 show that Xn X1 ln Yn 1 n n i 1 ln Xi has an approximate normal distribution when n is large. In fact, the approximating nor­ mal distribution when n 20 turns out to be an N 0 447940 0 105167 distribution. We have plotted this density in Figure 4.1.1. Another approach is to use the methods of Section 2.10 to generate N samples of 20 from pX, calculate ln Y20 for each (ln is a 1­1 transformation, and we size n transform to avoid the potentially large values assumed by Y20), and then use these N values to approximate the distribution of ln Y20 For example, in Figure 4.1.2 we have provided a plot of a density histogram (see Section 5.4.3 for more discussion of histograms) of N 20 generated (using the computer) from pX The area of each rectangle corresponds to the proportion of values of ln Y20 that were in the interval given by the base of the rectangle. As we will see in Sections 4.2, 4.3, and 4.4, these areas approximate the actual probabilities that ln Y20 falls in these intervals. These approximations improve as we increase N 104 values of ln Y20 calculated from N 104 samples of size n Notice the similarity in the shapes of Figures 4.1.1 and 4.1.2. Figure 4.1.2 is not
symmetrical about its center, however, as it is somewhat skewed. This is an indication that the normal approximation is not entirely adequate when n 20.0 0.5 lnY 1.0 Figure 4.1.1: Plot of the approximating N 0 447940 0 105167 density to the distribution of lnY20 in Example 4.1.1. 202 Section 4.1: Sampling Distributions.0 0.5 lnY 1.0 104 values of ln Y20 obtained by generating N 104 samples from Figure 4.1.2: Plot of N pX in Example 4.1.1. Sometimes we are lucky and can work out the sampling distribution of Y h X1 X2 Xn exactly in a form useful for computing probabilities and expectations for Y In general, PY B we will have to determine however, when we want to compute P Y B as given by the set of samples X1 X2 B Xn such that Y h 1 B x1 x2 xn : h x1 x2 xn B, h 1 B. This is typically an intractable prob­ and then compute P X1 X2 lem and approximations or simulation (Monte Carlo) methods will be essential. Tech­ niques for deriving such approximations will be discussed in subsequent sections of this chapter. In particular, we will develop an important approximation to the sampling distribution of the sample mean Xn X h X1 X2 Xn 1 n n i 1 Xi Summary of Section 4.1 A sampling distribution is the distribution of a random variable corresponding to a function of some i.i.d. sequence. Sampling distributions can sometimes be computed by direct computation or by approximations such as the central limit theorem. Chapter 4: Sampling Distributions and Limits 203 EXERCISES 1 3 X1 X2 X3 2 independent times. Compute p of chips labelled 1. For a sample of n 4.1.1 Suppose that X1 X2 X3 are i.i.d. from pX in Example 4.1.1. Determine the exact distribution of Y3 4.1.2 Suppose that a fair six­sided die is tossed n the exact distribution of the sample mean. 4.1.3 Suppose that an urn contains a proportion p of chips labelled 0 and proportion 1 2 drawn with replacement, determine the distribution of the sample mean. 4.1.4 Suppose that an
urn contains N chips labelled 0 and M chips labelled 1. For a sample of n 2 drawn without replacement, determine the distribution of the sample mean. 4.1.5 Suppose that a symmetrical die is tossed n the exact sampling distribution of the maximum of this sample. 4.1.6 Suppose three fair dice are rolled, and let Y be the number of 6’s showing. Com­ pute the exact distribution of Y. 4.1.7 Suppose two fair dice are rolled, and let W be the product of the two numbers showing. Compute the exact distribution of W. 4.1.8 Suppose two fair dice are rolled, and let Z be the difference of the two numbers showing (i.e., the first number minus the second number). Compute the exact distribu­ tion of Z. 4.1.9 Suppose four fair coins are ipped, and let Y be the number of pairs of coins which land the same way (i.e., the number of pairs that are either both heads or both tails). Compute the exact distribution of Y. 20 independent times. Work out COMPUTER EXERCISES 103 values of Y50 in Example 4.1.1 Calculate the 4.1.10 Generate a sample of N mean and standard deviation of this sample. 4.1.11 Suppose that X1 X2 tion. Generate a sample of N X10 Calculate the mean and standard deviation of this sample. X10 is an i.i.d. sequence from an N 0 1 distribu­ 103 values from the distribution of max X1 X2 PROBLEMS Xn is a sample from the Poisson X1 4.1.12 Suppose that X1 X2 termine the exact sampling distribution of Y the moment­generating function of Y and use the uniqueness theorem.) 4.1.13 Suppose that X1 X2 is a sample from the Uniform[0,1] distribution. Determine X2 (Hint: Determine the density of Y.) the exact sampling distribution of Y 4.1.14 Suppose that X1 X2 is a sample from the Uniform[0,1] distribution. Determine the exact sampling distribution of Y (Hint: Determine the density of ln Y and then transform.) distribution. De­ Xn (Hint: Determine X1 X2 X2 X1 1 2 204 Section 4.2: Convergence
in Probability 4.2 Convergence in Probability 1 Notions of convergence are fundamental to much of mathematics. For example, if an 3 4, etc. We see that the values of an are getting “closer and closer” to 1, and indeed we know from calculus that limn 1 n, then a1 1 in this case. 2 3, a4 1 2, a3 0, a2 an For random variables, notions of convergence are more complicated. If the values themselves are random, then how can they “converge” to anything? On the other hand, we can consider various probabilities associated with the random variables and see if they converge in some sense. The simplest notion of convergence of random variables is convergence in prob­ (Other notions of convergence will be developed in subsequent ability, as follows. sections.) Definition 4.2.1 Let X1 X2 be an infinite sequence of random variables, and let Y be another random variable. Then the sequence Xn converges in probability Y to Y, if for all 0 and we write Xn 0, limn P Xn Y P In Figure 4.2.1, we have plotted the differences Xn Y for selected values of n for 10 generated sequences Xn Y for a typical situation where the random variables Xn converge to a random variable Y in probability We have also plotted the horizontal 0 25 From this we can see the increasing concentration of the lines at distribution of Xn Y about 0, as n increases, as required by Definition 4.2.1. In fact, the 10 observed values of X100 Y all satisfy the inequality X100 0 25 for Y 2.00 1.00 0.25 ­0.25 ­1.00 ­2.00 10 25 50 n 100 Figure 4.2.1: Plot of 10 replications of Xn Y illustrating the convergence in probability of Xn to Y. We consider some applications of this definition. Chapter 4: Sampling Distributions and Limits 205 EXAMPLE 4.2.1 Let Y be any random variable, and let X1 variables are all identical to each other.) In that case, Xn X2 X3 lim n P Xn Y 0 for all 0. Hence, Xn P Y. Y. (That is, the random Y 0, so of course EXAMPLE 4.2.2 0 Suppose
P Xn whenever n 0. Hence, the sequence Xn converges in probability to Y. (Here, the distributions of Xn and Y are all degenerate.) 1 n 1. Hence, P Xn 1. Then P Xn for all 1 and P Y 0 as n Y Y 1 1 EXAMPLE 4.2.3 Let U Uniform[0 1]. Define Xn by Xn Y 1 3 U n 8 otherwise, 2 3 3 U 8 otherwise. 2 3 and define Y by Then P Xn Y P Xn, and the sequence Xn con­ Hence, P Xn verges in probability to Y. (This time, the distributions of Xn and Y are not degenerate.) for all 0 as n Y A common case is where the distributions of the Xn are not degenerate, but Y is just a constant, as in the following example. EXAMPLE 4.2.4 Suppose Zn Exponential n and let Y 0. Then P Zn Y P Zn ne nx dx e n Hence, again P Zn converges in probability to Y. Y 0 as n for all 0, so the sequence Zn 4.2.1 The Weak Law of Large Numbers One of the most important applications of convergence in probability is the weak law is a sequence of independent random variables of large numbers. Suppose X1 X2 that each have the same mean. For large n, what can we say about their average Mn 1 n X1 Xn? or Mn P.. Also, using 206 Section 4.2: Convergence in Probability Xn When the We refer to Mn as the sample average, or sample mean, for X1 sample size n is fixed, we will often use X as a notation for sample mean instead of Mn. For example, if we ip a sequence of fair coins, and if Xi 0 as the i th coin comes up heads or tails, then Mn represents the fraction of the first n coins that came up heads. We might expect that for large n, this fraction will be close to 1 2, i.e., to the expected value of the Xi. 1 or Xi The weak law of large numbers provides a precise sense in which average values Mn tend to get close to E Xi, for large n. Theorem 4.2.1 (Weak law of large numbers) Let X1 X2 pendent
random variables, each having the same mean 0, limn less than or equal to P Mn That is, the averages converge in probability to the common mean. Then for all be a sequence of inde­ and each having variance 0 PROOF Using linearity of expected value, we see that E Mn independence, we have Var Mn Var X2 Var Xn 1 n2 n Hence, by Chebychev’s inequality (Theorem 3.6.2), we have n 1 n2 Var X1 1 n2 P Mn Var Mn 2 2n This converges to 0 as n, which proves the theorem. It is a fact that, in Theorem 4.2.1, if we require the Xi variables to be i.i.d. instead of merely independent, then we do not even need the Xi to have finite variance. But we will not discuss this result further here. Consider some applications of the weak law of large numbers. EXAMPLE 4.2.5 Consider ipping a sequence of identical fair coins. Let Mn be the fraction of the first n coins that are heads. Then Mn 1 if the ith coin is heads, otherwise Xi 0. Hence, by the weak law of large numbers, we have Xn n, where Xi X1 lim n P Mn 0 49 lim n lim n lim n P Mn P Mn 0 5 0 5 0 01 0 01 or Mn 0 5 0 01 P Mn 0 5 0 01 0 and, similarly, limn likely that Mn is very close to 0 5. P Mn 0 51 0. This illustrates that for large n, it is very Chapter 4: Sampling Distributions and Limits 207 EXAMPLE 4.2.6 Consider ipping a sequence of identical coins, each of which has probability p of coming up heads. Let Mn again be the fraction of the first n coins that are heads. Then by the weak law of large numbers, for any 1. We thus see that for large n, it is very likely that Mn is very close to p. (The previous example corresponds to the special case p 0, limn 1 2.) P p Mn p be i.i.d. with distribution N 3 5 Then E Mn EXAMPLE 4.2.7 Let X1 X2 Mn law of large numbers, P 3 the average value Mn is very close to 3. EXAMPLE 4.2.8 Let
W1 W2 1 6 the weak law of large numbers, P 1 6 Hence, for large n, the average value Mn is very close to 1 6. 1 as n Mn 3 be i.i.d. with distribution Exponential 6. Then E Mn 3, and by the weak. Hence, for large n, 1 6, and by. 1 as n Summary of Section 4.2 A sequence Xn of random variables converges in probability to Y if lim n P Xn Y 0 The weak law of large numbers says that if Xn is i.i.d. (or is independent with constant mean and bounded variance), then the averages Mn Xn n converge in probability to E Xi. X1 EXERCISES Uniform[5 10], and let Z IU [5 7 and Zn IU [5 7 1 n2. Prove Z in probability. 4.2.1 Let U that Zn 4.2.2 Let Y 4.2.3 Let W1 W2 we have P W1 W2 4.2.4 Let Y1 Y2 Y2 P Y1 4.2.5 Let X1 X2 X2 have P X1 Uniform[0 1], and let Xn Y n. Prove that Xn be i.i.d. with distribution Exponential 3. Prove that for some n, 0 in probability. Wn n 2 0 999. be i.i.d. with distribution N 2 5. Prove that for some n, we have Yn 0 999. n be i.i.d. with distribution Poisson 8. Prove that for some n, we Xn 9n 0 001. Prove that Yn 0. Prove that Xn 4.2.6 Suppose X Uniform[0 1], and let Yn 4.2.7 Let Hn be the number of heads when ipping n fair coins, let Xn let Y 4.2.8 Let Zn P Wn 4.2.9 Consider ipping n fair coins. Let Hn be the total number of heads, and let Fn be the number of heads on coins 1 through n 1 (i.e., omitting the nth coin). Let 1, and Yn Xn 1, and let W 5. Prove that Uniform[0 n], let Wn 0. Prove that Xn e Hn, and 5Zn Zn 1
, and Z Hn Hn Fn Hn W. Yn Z. P 208 Section 4.3: Convergence with Probability 1 4.2.10 Let Zn be the sum of the squares of the numbers showing when we roll n fair dice. Find (with proof) a number m such that 1 m. (Hint: Use the weak law of large numbers.) 4.2.11 Consider ipping n fair nickels and n fair dimes. Let Xn equal 4 times the number of nickels showing heads, plus 5 times the number of dimes showing heads. Find (with proof) a number r such that 1 n Xn n Zn r. P P COMPUTER EXERCISES 20 Repeat this N times, where N is large (if possible, take N Xn distributed Exponential 5 and compute Mn when 4.2.12 Generate i.i.d. X1 105 otherwise n as large as is feasible), and compute the proportion of values of Mn that lie between 50 What property of convergence in probability 0.19 and 0.21. Repeat this with n do your results illustrate? 4.2.13 Generate i.i.d. X1 105 otherwise as 20 Repeat this N times, where N is large (if possible, take N large as is feasible), and compute the proportion of values of Mn that lie between 6.99 and 7.01. Repeat this with n 100 What property of convergence in probability do your results illustrate? Xn distributed Poisson 7 and compute Mn when n PROBLEMS 4.2.14 Give an example of random variables X1 X2 0 in probability, but E Xn P Xn 0 1 1 for all n. (Hint: Suppose P Xn such that Xn converges to 1 n and n 4.2.15 Prove that Xn 1 n.) P 4.2.16 Prove or disprove that Xn 5 if and only if Xn P 5. 0 if and only if Xn P P 0. 4.2.17 Suppose Xn P that Zn Z. P X, and Yn P Y. Let Zn Xn Yn and Z X Y. Prove CHALLENGES 4.2.18 Suppose Xn P X, and f is a continuous function. Prove that f Xn P f X. 4.3 Convergence with Probability 1 A notion of convergence for
random variables that is closely associated with the con­ vergence of a sequence of real numbers is provided by the concept of convergence with probability 1. This property is given in the following definition. be an infinite sequence of random variables. We Definition 4.3.1 Let X1 X2 shall say that the sequence Xi converges with probability 1 (or converges almost surely (a.s.)) to a random variable Y, if P limn 1 and we write Xn Xn a s Y Y Chapter 4: Sampling Distributions and Limits 209 In Figure 4.3.1, we illustrate this convergence by graphing the sequence of differ­ Y for a typical situation where the random variables Xn converge to a ences Xn random variable Y with probability 1. We have also plotted the horizontal lines at for or, in other words, the values of Xn are within 0 1 of the values of Y 0 1 Notice that inevitably all the values Xn Y are in the interval 0 1 0 1 Y for every n Definition 4.3.1 indicates that for any given 0 there will exist a value N N The value of N will vary depending on such that Xn the observed value of the sequence Xn but it always exists. Contrast this with Y the situation depicted in Figure 4.2.1, which only says that the probability distribution Xn Y Y concentrates about 0 as n grows and not that the individual values of Xn will necessarily all be near 0 (also see Example 4.3.2)..2 0.1 0.0 ­0.1 ­0.2 ­0.3 ­0.4 0 500 n 1000 Figure 4.3.1: Plot of a single replication Xn Y illustrating the convergence with probability 1 of Xn to Y. Consider an example of this. EXAMPLE 4.3.1 Consider again the setup of Example 4.2.3, where U Uniform[0 1], and Xn Y 3 U 8 otherwise 2 3 1 n 3 U 8 otherwise 2 3 2 3, then Y If U then for large enough n we will also have 8 and also Xn 8 for all n, so clearly Xn Y. If U 2 3, U 2 3 1 n so again Xn even though Y 0, we do have Xn Y. On the other hand, if U 2 3, then we will always have
Xn 8, 3. Hence, Xn Y except when U 2 3. Because P U 2 3 Y with probability 1. 210 Section 4.3: Convergence with Probability 1 One might wonder what the relationship is between convergence in probability and convergence with probability 1. The following theorem provides an answer. Z with Theorem 4.3.1 Let Z Z1 Z2 Z in probability. That is, if a sequence of random probability 1. Then Zn variables converges almost surely, then it converges in probability to the same limit. be random variables. Suppose Zn PROOF See Section 4.7 for the proof of this result. On the other hand, the converse to Theorem 4.3.1 is false, as the following example shows. EXAMPLE 4.3.2 Let U have the uniform distribution on [0 1]. We construct an infinite sequence of random variables Xn by setting X1 X3 X7 I[0 1 2 U X2 I[0 1 4 U X4 I[0 1 8 U X8 I[1 2 1] U I[1 4 1 2 U X5 I[1 8 1 4 U I[1 2 3 4 U X6 I[3 4 1] U where I A is the indicator function of the event A, i.e., I A s 0 if s A 1 if s A, and I A s Note that we first subdivided [0 1] into two equal­length subintervals and defined X1 and X2 as the indicator functions for the two subintervals. Next we subdivided [0 1] into four equal­length subintervals and defined X3 X4 X5 and X6 as the indicator functions for the four subintervals. We continued this process by next dividing [0 1] into eight equal­length subintervals, then 16 equal­length subintervals, etc., to obtain an infinite sequence of random variables. Each of these random variables Xn takes the values 0 and 1 only and so must follow a Bernoulli distribution. In particular, X1 Bernoulli 1 2 X2 Bernoulli 1 2 X3 Bernoulli 1 4 Then for 0 etc. the intervals for U that make Xn P Xn 1 is converging to 0. Hence, Xn converges to 0 in probability. 1
we have that P Xn 1. Because 0 are getting smaller and smaller, we see that P Xn 0 On the other hand, Xn does not converge to 0 almost surely. Indeed, no matter what 1. 1 infinitely often, so that we will not have Xn converging 0, and Xn does not value U takes on, there will always be infinitely many different n for which Xn Hence, we will have Xn to 0 for any particular value of U. Thus, P limn converge to 0 with probability 1. Xn 0 Theorem 4.3.1 and Example 4.3.2 together show that convergence with probability 1 is a stronger notion than convergence in probability. Now, the weak law of large numbers (Section 4.2.1) concludes only that the av­ erages Mn are converging in probability to E Xi. A stronger version of this result would instead conclude convergence with probability 1. We consider that now. Chapter 4: Sampling Distributions and Limits 211 4.3.1 The Strong Law of Large Numbers The following is a strengthening of the weak law of large numbers because it concludes convergence with probability 1 instead of just convergence in probability. Theorem 4.3.2 (Strong law of large numbers) Let X1 X2 i.i.d. random variables, each having finite mean. Then be a sequence of P lim n Mn 1 That is, the averages converge with probability 1 to the common mean a s or Mn. PROOF See A First Look at Rigorous Probability Theory, Second Edition, by J. S. Rosenthal (World Scientific Publishing Co., 2006) for a proof of this result. This result says that sample averages converge with probability 1 to. E Xi Like Theorem 4.2.1, it says that for large n the averages Mn are usually close to for large n. But it says in addition that if we wait long enough (i.e., if n is large enough), then eventually the averages will all be close to, for all sufficiently large n. In other words, the sample mean is consistent for Summary of Section 4.3 A sequence Xn of random variables converges with probability 1 (or converges almost surely) to Y if, P limn Convergence with probability 1 implies convergence in probability. The strong law of large numbers says that if Xn Mn
Xn n converge with probability 1 to E Xi. is i.i.d., then the averages X1 Xn Y 1 EXERCISES be i.i.d. with distribution Exponential 3. Prove that with prob­ I[5 7 U (i.e., Z is the indicator function Z with probability 1. Y n. Prove that Xn Uniform[0 1], and let Xn I[5 7 1 n2 U. Prove that Zn 4.3.1 Let U Uniform[5 10], and let Z of [5 7 ) and Zn 4.3.2 Let Y 1. 4.3.3 Let W1 W2 ability 1, for some n, we have W1 W2 4.3.4 Let Y1 Y2 for some n, we have Y1 4.3.5 Suppose Xn that P Xn 4.3.6 Suppose Z1 Z2 Determine (with explanation) whether the following statements are true or false. Y are i.i.d. with finite mean. Let Mn Yn X with probability 1, and also Yn X and Yn n 2. Wn Z1 Y2 n. 1. be i.i.d. with distribution N 2 5. Prove that with probability 1, Y with probability 1. Prove 0 with probability Zn n. 212 Section 4.3: Convergence with Probability 1 x a s a s m. n Zn for some n. 0 01 Mn 0 01 Mn 0 01 Mn 0 01 for some n. 0 01 for all but finitely many n. 0 01 for some n. Xn n. X1 X2 m. (Hint: Use the strong law of large (a) With probability 1, Mn (b) With probability 1, (c) With probability 1, R1, with probability 1, x (d) For any x 4.3.7 Let Xn be i.i.d., with Xn Uniform[3 7]. Let Yn Find (with proof) a number m such that Yn numbers.) 4.3.8 Let Zn be the sum of the squares of the numbers showing when we roll n fair dice. Find (with proof) a number m such that 1 4.3.9 Consider ipping n fair nickels and n fair dimes. Let Xn equal 4 times the
number of nickels showing heads, plus 5 times the number of dimes showing heads. Find (with proof) a number r such that 1 n Xn a s Y. Does this imply that P Y5 4.3.10 Suppose Yn 0? Explain. 4.3.11 Consider repeatedly ipping a fair coin. Let Hn be the number of heads on the first n ips, and let Zn (a) Prove that there is some m such that Zn (b) Let r be the smallest positive integer satisfying Zr Zn 4.3.12 Suppose P X (That is, the random variables Xn are all identical.) Let Yn (a) Prove that P limn 1 Yn Yn (b) Prove that there is no number m such that P limn (c) Why does part (b) not contradict the law of large numbers? r? Why or why not? P X 0 001. Must we have 0 001 for all n m. 1 2. Yn m X for n X1 X2 1 2, and let Xn. Xn n. 0 001 for all n P limn Hn n Y4 1. r. a s Y Y 0 0 1 COMPUTER EXERCISES 4.3.13 Generate i.i.d. X1 105 if possible). Plot the values M1 M2 How quickly? 4.3.14 Generate i.i.d. X1 possible). Plot the values M1 M2 quickly? 4.3.15 Generate i.i.d. X1 X2 if possible). Plot the values M1 M2 quickly? Xn distributed Exponential 5 with n large (take n Mn. To what value are they converging? Xn distributed Poisson 7 with n large (take n 105 if Mn. To what value are they converging? How Xn distributed N 4 3 with n large (take n 105 Mn. To what value are they converging? How PROBLEMS such that P limn 1 4.3.16 Suppose for each positive integer k, there are random variables Wk Xk 1 Xk 2 Xk n Wk for all k 1. Prove that P limn Xk n Wk 4.3.17 Prove that Xn 4.3.18 Prove or disprove that Xn 0
if and only if Xn a s 5 if and only if Xn a s 5. a s 0. a s Chapter 4: Sampling Distributions and Limits 213 4.3.19 Suppose Xn a s that Zn Z. a s X, and Yn a s Y. Let Zn Xn Yn and Z X Y. Prove CHALLENGES such that P limn Xn r Wr for all r 4.3.20 Suppose for each real number r Xr 2 P limn 4.3.21 Give an example of random variables X1 X2 0 with probability 1, but E Xn 4.3.22 Suppose Xn Xr n Wr [0 1] 1 for all n. 1. a s [0 1], there are random variables Wr Xr 1 1. Prove or disprove that we must have such that Xn converges to X, and f is a continuous function. Prove that f Xn a s f X. 4.4 Convergence in Distribution There is yet another notion of convergence of a sequence of random variables that is important in applications of probability and statistics. Definition 4.4.1 Let X X1 X2 sequence Xn converges in distribution to X if for all x P Xn x 0 we have limn P X x x R1 such that P X D and we write Xn X be random variables. Then we say that the Intuitively, Xn converges in distribution to X if for large n, the distribution of Xn is close to that of X. The importance of this, as we will see, is that often the distribution of Xn is difficult to work with, while that of X is much simpler. With Xn converging in distribution to X however, we can approximate the distribution of Xn by that of X EXAMPLE 4.4.1 Suppose P Xn 0 P X 1 1. Then, 1 n, and P Xn 0 1 1 n. Let X 0 so that P Xn As P Xn x x for every x and in particular at all x 0 we have that Xn converges in distribution to X. Intuitively, as P X x, it is more and more likely that Xn will equal 0. 1 P X 1 2 1 1 n, and P Xn 1 n. Suppose further 1 2 1 2. Then Xn converges in distribution
to X because 0 1 2 and P Xn 0 1 2 as n. EXAMPLE 4.4.3 Let X absolutely continuous, while Xn is discrete. On the other hand, for any 0 Uniform[0 1], and let P Xn 1 n for i 1 2 i n n. Then X is 1, we x as n where P X n EXAMPLE 4.4.2 Suppose P Xn that P X 0 P Xn 1 214 have P X x, we have Section 4.4: Convergence in Distribution x x and letting x denote the greatest integer less than or equal to P Xn x nx n Hence, P Xn indeed have Xn x P X x 1 n for all n. Because limn 1 n 0, we do X in distribution. EXAMPLE 4.4.4 Suppose X1 X2 the weak law of large numbers says that for any are i.i.d. with finite mean, and Mn X1 0 we have Xn n Then P Mn 0 and P Mn 1. It follows that limn as n M is the constant random variable M it is not necessarily the case that P Mn not contradict the definition of convergence in distribution because P M so we do not need to worry about the case x, where M in distribution. Note that 1. However, this does 0 x. Hence, Mn P M P M x for any x P Mn. EXAMPLE 4.4.5 Poisson Approximation to the Binomial Suppose Xn 2.3.6 that Binomial n n and X Poisson. We have seen in Example P Xn!. This implies that FX n x and as n these are precisely the points for which P X 0 Therefore, Xn converges in distribution to X. (Indeed, this was our original motivation for the Poisson distribution.) FX x at every point x 0 1 2 x Many more examples of convergence in distribution are given by the central limit theorem, discussed in the next section. We first pause to consider the relationship of convergence in distribution to our previous notions of convergence. Theorem 4.4.1 If Xn P X, then Xn D X. PROOF See Section 4.7 for the proof of this result. The converse to Theorem 4.4.1 is false. Indeed, the fact that Xn converges in distribution to X says nothing about the
underlying relationship between Xn and X, it says only something about their distributions. The following example illustrates this. EXAMPLE 4.4.6 Suppose X X1 X2 case, P Xn in distribution to X. On the other hand, because X and Xn are independent, 1 with probability 1 2 each. In this R1, so of course Xn converges x for all n and for all x are i.i.d., each equal to P X x P X Xn 2 1 2 Chapter 4: Sampling Distributions and Limits 215. Hence, Xn does not converge to X in for all n, which does not go to 0 as n probability (or with probability 1). So we can have convergence in distribution without having convergence in probability or convergence with probability 1. The following result, stated without proof, indicates how moment­generating func­ tions can be used to check for convergence in distribution. (This generalizes Theo­ rem 3.4.6.) Theorem 4.4.2 Let X be a random variable, such that for some s0 m X s ables with m Zn s Zn converges to X in distribution. 0, we have is a sequence of random vari­ s0 s0, then s0 s0. If Z1 Z2 m X s for all s whenever s and limn m Zn s We will make use of this result to prove one of the most famous theorems of probability — the central limit theorem. Finally, we note that combining Theorem 4.4.1 with Theorem 4.3.1 reveals the following. Corollary 4.4.1 If Xn X with probability 1, then Xn D X 4.4.1 The Central Limit Theorem We now present the central limit theorem, one of the most important results in all of probability theory. Intuitively, it says that a large sum of i.i.d. random variables, prop­ erly normalized, will always have approximately a normal distribution. This shows that the normal distribution is extremely fundamental in probability and statistics — even though its density function is complicated and its cumulative distribution function is intractable. Suppose X1 X2 is an i.i.d. sequence of random variables each having finite and finite variance Xn be the sample sum and X1 Sn n be the sample mean. The central limit theorem is concerned with the 2 Let Sn mean
Mn distribution of the random variable Zn Sn n Mn n n Mn n 0 and Var Zn 2 We know E Mn 2 n which implies that where 1 The variable Zn is thus obtained from the sample mean E Zn (or sample sum) by subtracting its mean and dividing by its standard deviation. This transformation is referred to as standardizing a random variable, so that it has mean 0 and variance 1. Therefore, Zn is the standardized version of the sample mean (sample sum). and Var Mn Note that the distribution of Zn shares two characteristics with the N 0 1 distrib­ ution, namely, it has mean 0 and variance 1. The central limit theorem shows that there is an even stronger relationship. 216 Section 4.4: Convergence in Distribution Theorem 4.4.3 (The central limit theorem) Let X1 X2 2. Let Z and finite variance N 0 1. Then as n be i.i.d. with finite mean, the sequence Zn converges in distribution to Z, i.e., Zn D Z. PROOF See Section 4.7 for the proof of this result. The central limit theorem is so important that we shall restate its conclusions in several different ways. Corollary 4.4.2 For each fixed x the cumulative distribution function for the standard normal distribution. P Zn x R1, limn x where is We can write this as follows. Corollary 4.4.3 For each fixed x R1, lim n P Sn n x n x and lim n P Mn x n x In particular, Sn is approximately equal to n, with deviations from this value of order n, and Mn is approximately equal to, with deviations from this value of order 1 n. We note that it is not essential in the central limit theorem to divide by, in which ) converges in n n (or 2 distribution. That is, the limiting distribution will still be case the theorem asserts instead that Sn distribution to the N 0 normal but will have variance 2 instead of variance 1. n Mn Similarly, instead of dividing by exactly, it suffices to divide by any quantity n,. A simple modification of the proof of Theorem 4.4.2 leads to the a s provided n following result. Corollary 4.4.4 If Zn Sn n n n Mn n
n Mn n n and limn a s n, then Zn D Z as n. To illustrate the central limit theorem, we consider a simulation experiment. EXAMPLE 4.4.7 The Central Limit Theorem Illustrated in a Simulation Suppose we generate a sample X1 Xn from the Uniform[0 1] density. Note that the Uniform[0 1] density is completely unlike a normal density. An easy calculation shows that when X Uniform[0 1] then E X 1 2 and Var X 1 12 Now suppose we are interested in the distribution of the sample average Mn Sn n us that X1 Xn n for various choices of n The central limit theorem tells Zn Sn n 2 n 12 n Mn 1 2 1 12 Chapter 4: Sampling Distributions and Limits 217 converges in distribution to an N 0 1 distribution. But how large does n have to be for this approximation to be accurate? 4 4 To assess this, we ran a Monte Carlo simulation experiment. In Figure 4.4.1, we 105 values from the N 0 1 distribution based have plotted a density histogram of N 0 01. Density histograms are more on 800 subintervals of extensively discussed in Section 5.4.3, but for now we note that above each interval we have plotted the proportion of sampled values that fell in the interval, divided by the length of the interval. As we increase N and decrease l these histograms will look more and more like the density of the distribution from which we are sampling. Indeed, Figure 4.4.1 looks very much like an N 0 1 density, as it should. each of length l 12 2 In Figure 4.4.2, we have plotted a density histogram (using the same values of N and l) of Z1 Note that Z1 Uniform[ 12 2] and indeed the histogram does look like a uniform density. Figure 4.4.3 presents a density histogram of Z2 which still looks very nonnormal — but note that the histogram of Z3 in Figure 4.4.4 is beginning to look more like a normal distribution. The histogram of Z10 in Fig­ ure 4.4.5 looks very normal. In fact, the proportion of Z10 values in for this histogram, equals 0 9759 while the exact proportion for an N 0 1 distribution is 0 9750. 1 96] y t i s n e D 0.4 0.3 0.2 0.1 0.
0 ­4 ­3 ­2 ­1 0 1 2 3 4 Figure 4.4.1: Density histogram of 105 standard normal values. y t i s n e D 0.4 0.3 0.2 0.1 0.0 ­4 ­3 ­2 ­1 0 1 2 3 4 Figure 4.4.2: Density histogram for 105 values of Z1 in Example 4.4.7. 218 Section 4.4: Convergence in Distribution y t i s n e D 0.4 0.3 0.2 0.1 0.0 ­4 ­3 ­2 ­1 0 1 2 3 4 Figure 4.4.3: Density histogram for 105 values of Z2 in Example 4.4.7. y t i s n e D 0.4 0.3 0.2 0.1 0.0 ­4 ­3 ­2 ­1 0 1 2 3 4 Figure 4.4.4: Density histogram for 105 values of Z3 in Example 4.4.7. y t i s n e D 0.4 0.3 0.2 0.1 0.0 ­4 ­3 ­2 ­1 0 1 2 3 4 Figure 4.4.5: Density histogram for 105 values of Z10 in Example 4.4.7. So in this example, the central limit theorem has taken effect very quickly, even though we are sampling from a very nonnormal distribution. As it turns out, it is Chapter 4: Sampling Distributions and Limits 219 primarily the tails of a distribution that determine how large n has to be for the central limit theorem approximation to be accurate. When a distribution has tails no heavier than a normal distribution, we can expect the approximation to be quite accurate for relatively small sample sizes. We consider some further applications of the central limit theorem. EXAMPLE 4.4.8 For example, suppose X1 X2 distribution. Recall that this implies that Hence, for each fixed x R1, we have are i.i.d. random variables, each with the Poisson 5 5. 5 and 2 Var Xi E Xi P Sn 5n x 5n x as n EXAMPLE 4.4.9 Normal Approximation to the Binomial Distribution Suppose X1 X2 tion. Recall that this implies that E Xi each fixed x are i.i.d. random variables, each with the
Bernoulli and R1 we have Var Xi 1 distribu­. Hence, for P Sn n x n 1 x (4.4.1) as n But now note that we have previously shown that Yn (4.4.1) implies that whenever we have a random variable Yn Sn Binomial n So Binomial n then P Yn y P Yn 4.4.2) for large n Note that we are approximating a discrete distribution by a continuous distribu­ tion here. Reecting this, a small improvement is often made to (4.4.2) when y is a nonnegative integer. Instead, we use P Yn y n y 0 5 1 n Adding 0.5 to y is called the correction for continuity. In effect, this allocates all the relevant normal probability in the interval y 0 5 to the nonnegative integer y This has been shown to improve the approximation (4.4.2). 0 5 y EXAMPLE 4.4.10 Approximating Probabilities Using the Central Limit Theorem While there are tables for the binomial distribution (Table D.6), we often have to com­ pute binomial probabilities for situations the tables do not cover. We can always use statistical software for this, in fact, such software makes use of the normal approxima­ tion we derived from the central limit theorem. For example, suppose that we have a biased coin, where the probability of getting 1000 times and then 0 6 We will toss the coin n a head on a single toss is 220 Section 4.4: Convergence in Distribution calculate the probability of getting at least 550 heads and no more than 625 heads. If Y denotes the number of heads obtained in the 1000 tosses, we have that Y Binomial 1000 0 6 so E Y Var Y 1000 0 6 1000 0 6 0 4 600 240 Therefore, using the correction for continuity and Table D.2, P 550 Y 625 P 550 0 5 Y 625 0 5 P P 549 5 600 Y 600 625 5 600 240 240 240 3 2598 Y 600 240 1 646 1 65 3 26 0 9505 0 0006 0 9499 Note that it would be impossible to compute this probability using the formulas for the binomial distribution. One of the most important uses of the central limit theorem is that it leads to a method for assessing the error in an average when this is estimating or approximating some quantity of interest. 4.4.2 The
Central Limit Theorem and Assessing Error Suppose X1 X2 and finite variance is an i.i.d. sequence of random variables, each with finite mean 2, and we are using the sample average Mn to approximate the mean This situation arises commonly in many computational (see Section 4.5) and statistical (see Chapter 6) problems. In such a context, we can generate the Xi but we do not know the value of If we approximate by Mn then a natural question to ask is: How much error is there in the approximation? The central limit theorem tells us that 3 3 lim n P 3 Mn 3 n lim n P Mn 3 n Mn 3 n Using Table D.2 (or statistical software), we have that 0 9987 3 0 9974 So, for large n, we have that the interval 3 0 9987 1 Mn 3 n Mn 3 n contains the unknown value of with virtual certainty (actually with probability about n of this interval gives us an assessment of 0 9974). Therefore, the half­length 3 2 n so the half­length of the error in the approximation Mn. Note that Var Mn the interval equals 3 standard deviations of the estimate Mn Chapter 4: Sampling Distributions and Limits 221 Because we do not know definition uses Corollary 4.4.4 instead to construct such an interval. ). But if we can find a consistent estimate it is extremely unlikely that we will know (as its, then we can use n of As it turns out, the correct choice of n depends on what we know about the distri­ bution we are sampling from (see Chapter 6 for more discussion of this). For example, and 2 Var X1 if X1. By the strong law of large numbers (Theorem 4.3.2), Mn Bernoulli and thus then a s 1 n Mn 1 Mn a s 1 Then, using the same argument as above, we have that, for large n the interval Mn 3 Mn 1 Mn n Mn 3 Mn 1 Mn n (4.4.3) contains the true value of with virtual certainty (again, with probability about 0 9974). The half­length of (4.4.3) is a measure of the accuracy of the estimate Mn — no­ Xn We refer to the quantity tice that this can be computed from the values X1 Mn 1 Mn n 1 2 as the standard error of the estimate Mn For a general
random variable X1 let Xi Mn 2M2 n M2 2Mn Xi n M2 n i 1 n i M2 X 2 n i 1 1 n By the strong law of large numbers, we have that Mn a s and and M2 n Because n hence implies that n variance of the sample X1 denote this estimate of the variance by S2 n is consistent for 2 as well, we conclude that 2 This 2 n the sample Xn When the sample size n is fixed, we will often It is common to call 2 n Again, using the above argument, we have that, for large n the interval Mn 3 n n Mn 3 n n Mn 3S n Mn 3S n (4.4.4) contains the true value of with virtual certainty (also with probability about 0 9974). Therefore, the half­length is a measure of the accuracy of the estimate Mn — notice n is referred that this can be computed from the values X1 to as the standard error of the estimate Mn. Xn The quantity S We will make use of these estimates of the error in approximations in the following section. 222 Section 4.4: Convergence in Distribution Summary of Section 4.4 A sequence Xn of random variables converges in distribution to Y if, for all y R1 with P Y P Y FY y, i.e., limn 0, we have limn FXn y y y. y P Xn and variance If Xn converges to Y in probability (or with probability 1), then Xn converges to Y in distribution. The very important central limit theorem says that if Xn are i.i.d. with finite 2, then the random variables Zn mean converge in distribution to a standard normal distribution. The central limit theorem allows us to approximate various distributions by nor­ mal distributions, which is helpful in simulation experiments and in many other contexts. Table D.2 (or any statistical software package) provides values for the cumulative distribution function of a standard normal. Sn n n EXERCISES i i n 3n i 6 for i 1 2 3. Prove that Xn converges in distribution to X. 1 2k 1 for k k 4.4.1 Suppose P Xn P X 1 3 for i 4.4.2 Suppose P Yn Geometric 1 2. Prove that Yn converges in distribution to Y. 4.4.3 Let Zn
have density n Prove that Zn converges in distribution to Z. 4.4.4 Let Wn have density 1, and 0 otherwise. Let Z 1 x n for 0 2 n 1 0 1 1 x n. Let Y 1 2 3. Suppose also that 1. 1 1 x n 1 2n 1, and 0 otherwise. Let W Uniform[0 1]. Prove that Wn converges for 0 x in distribution to W. 4.4.5 Let Y1 Y2 theorem and Table D.2 (or software) to estimate the probability P 4.4.6 Let Z1 Z2 limit theorem and Table D.2 (or software) to estimate the probability P 1600 i 1 Yi be i.i.d. with distribution Exponential 3. Use the central limit be i.i.d. with distribution Uniform[ 20 10]. Use the central 540. 900 i 1 Zi 4470. 4.4.7 Let X1 X2 be i.i.d. with distribution Geometric 1 4. Use the central limit theorem and Table D.2 (or software) to estimate the probability P 2450. N 0 1 n, i.e., Xn has a normal distribution with mean 0 and 4.4.8 Suppose Xn variance 1 n. Does the sequence Xn converge in distribution to some random vari­ able? If yes, what is the distribution of the random variable? 1 for i 4.4.9 Suppose P Xn 1 2 3 1, otherwise f z function given by f z (a) Compute P Z (b) Compute P Xn 2i n n z 1. m n for some integer 1 n. (Hint: Remember that n. Let Z have density 2z for 0 y 800 i 1 Xi y for 0 i n 0.) Chapter 4: Sampling Distributions and Limits 223 (c) Compute P Xn D (d) Prove that Xn y for 0 y 1. Z. 0. Prove that Yn D Y where 4.4.10 Suppose P Yn Exponential Y y for some 1 e 2ny n 1 for all y 0 and compute. n for all 0 1 D n z z 1 c n Exponential 16. 36. 100. 1 for some n 3. Prove that Zn ec for any real number c.) 3z Z n 0 and compute. (Hint: Recall from calculus 4.4.11 Suppose P
Zn where Z that limn 4.4.12 Suppose the service time, in minutes, at a bank has the Exponential distribution with 1 2. Use the central limit theorem to estimate the probability that the average service time of the first n customers is less than 2.5 minutes, when: (a) n (b) n (c) n 4.4.13 Suppose the number of kilograms of a metal alloy produced by a factory each week is uniformly distributed between 20 and 30. Use the central limit theorem to esti­ mate the probability that next year’s output will be less than 1280 kilograms. (Assume that a year contains precisely 52 weeks.) 4.4.14 Suppose the time, in days, until a component fails has the Gamma distribution with 1 10. When a component fails, it is immediately replaced by a new component. Use the central limit theorem to estimate the probability that 40 components will together be sufficient to last at least 6 years. (Assume that a year contains precisely 365.25 days.) 5 and COMPUTER EXERCISES X20 Exponential 3 for N large (N Uniform[ 20 10] for N large (N 104, 4.4.15 Generate N samples X1 X2 if possible). Use these samples to estimate the probability P 1 6 M20 1 2. How does your answer compare to what the central limit theorem gives as an approximation? 4.4.16 Generate N samples X1 X2 X30 104, if possible). Use these samples to estimate the probability P M30 5. How does your answer compare to what the central limit theorem gives as an approximation? X20 4.4.17 Generate N samples X1 X2 104, if possible). Use these samples to estimate the probability P 2 5 M20 3 3. How does your answer compare to what the central limit theorem gives as an approxi­ mation? 4.4.18 Generate N samples X1 X2 Gamma 4 1 for N large (N density histogram of the values of M20 Comment on the shape of this graph. 4.4.19 Generate N samples X1 X2 for N large (N of the values of M20 Comment on the shape of this graph. X20 from the Binomial 10 0 01 distribution 104, if possible). Use these samples to construct a density histogram 104, if possible). Use these samples to construct a X20 from the
distribution of log Z where Z Geometric 1 4 for N large (N 224 Section 4.5: Monte Carlo Approximations PROBLEMS 4.4.20 Let a1 a2 Suppose P X absolutely continuous random variables, such that Xn 0 4.4.21 Let f : [0 1] i be any sequence of nonnegative real numbers with 1. ai for every positive integer i. Construct a sequence Xn of i ai be a continuous positive function such that X in distribution. 1 Consider random variables X and Xn such that P a X b 1 0 f x dx b a f x dx for a b and P Xn in distribution. j n n. Prove that Xn X 3 for i 1 2 3 i and that X1 4.4.22 Suppose that Yi tribution. Indicate how you would approximate the probability P Mn Mn Y1 4.4.23 Suppose Yi distribution. Indicate how you would approximate the probability P Mn cos 2 Ui and U1 Yn n Xn is a sample from an N 0 1 dis­ m where Un is a sample from the Uniform[0 1] m, where Mn Y1 Yn n COMPUTER PROBLEMS X 3 and X N 0 1. By generating a large sample (n 4.4.24 Suppose that Y 104, if possible) from the distribution of Y approximate the probability P Y 1 and assess the error in your approximation Compute this probability exactly and compare it with your approximation. N 0 1. By generating a large sample (n 4.4.25 Suppose that Y 104, if possible) from the distribution of Y approximate the expectation E cos X 3 and assess the error in your approximation X 3 and X, CHALLENGES 4.4.26 Suppose Xn C in probability. (This proves that if X is constant, then the converse to Theorem 4.4.1 does hold, even though it does not hold for general X.) C in distribution, where C is a constant. Prove that Xn 4.5 Monte Carlo Approximations The laws of large numbers say that if X1 X2 ables with mean, and X1 Mn is an i.i.d. sequence of random vari­ Xn, n then for large n we will have Mn. Suppose now that is unknown. Then, as discussed in Section 4.4.2, it is possible to change perspective and use Mn (for
large n) as an estimator or approximation of. Any time we approximate or estimate a quantity, we must also say something about Chapter 4: Sampling Distributions and Limits 225 how much error is in the estimate. Of course, we cannot say what this error is exactly, as that would require knowing the exact value of. In Section 4.4.2, however, we showed how the central limit theorem leads to a very natural approach to assessing this error, using three times the standard error of the estimate. We consider some examples. EXAMPLE 4.5.1 of Consider ipping a sequence of identical coins, each of which has probability coming up heads, but where is unknown. Let Mn again be the fraction of the first n coins that are heads. Then we know that for large n, it is very likely that Mn is very close to. Hence, we can use Mn to estimate. Furthermore, the discussion in Section 4.4.2 indicates that (4.4.3) is the relevant interval to quote when assessing the accuracy of the estimate Mn. EXAMPLE 4.5.2 Suppose we believe a certain medicine lowers blood pressure, but we do not know by how much. We would like to know the mean amount, by which this medicine lowers blood pressure. Suppose we observe n patients (chosen at random so they are i.i.d.), where patient i has blood pressure Bi before taking the medicine and blood pressure Ai afterwards. Let Xi Ai Then Bi n Mn 1 n Bi Ai i 1 is the average amount of blood pressure decrease. (Note that Bi Ai may be negative for some patients, and it is important to also include those negative terms in the sum.) Then for large n, the value of Mn is a good estimate of E Xi. Furthermore, the discussion in Section 4.4.2 indicates that (4.4.4) is the relevant interval to quote when assessing the accuracy of the estimate Mn. Such estimators can also be used to estimate purely mathematical quantities that do not involve any experimental data (such as coins or medical patients) but that are too difficult to compute directly. In this case, such estimators are called Monte Carlo ap­ proximations (named after the gambling casino in the principality of Monaco because they introduce randomness to solve nonrandom problems). EXAMPLE 4.5.3 Suppose we wish to evaluate I 1 0 cos x 2 sin x 4 dx This integral cannot
easily be solved exactly. But it can be approximately computed using a Monte Carlo approximation, as follows. We note that I E cos U 2 sin U 4 where U to Mn i.i.d. Uniform[0 1]. T1 Uniform[0 1]. Hence, for large n, the integral I is approximately equal are, and where U1 U2 Tn n, where Ti cos U 2 i sin U 4 i 226 Section 4.5: Monte Carlo Approximations Putting this all together, we obtain an algorithm for approximating the integral I, as follows. 1. Select a large positive integer n. 2. Obtain Ui Uniform[0 1], independently for i 1 2 n. 3. Set Ti cos U 2 i sin U 4 i, for i 1 2 n. 4. Estimate I by Mn T1 Tn n. For large enough n, this algorithm will provide a good estimate of the integral I. For example, the following table records the estimates Mn and the intervals (4.4.4) based on samples of Uniform[0,1] variables for various choices of n n 103 104 105 Mn 0 145294 0 138850 0 139484 Mn 3S 0 130071 0 134105 0 137974 n Mn 3S 0 160518 0 143595 0 140993 n From this we can see that the value of I is approximately 0 139484 and the true value is almost certainly in the interval 0 137974 0 140993. Notice how the lengths of the intervals decrease as we increase n In fact, it can be shown that the exact value is I 0 139567, so our approximation is excellent. EXAMPLE 4.5.4 Suppose we want to evaluate the integral I 25x 2 cos x 2 e 25x dx 0 This integral cannot easily be solved exactly, but it can also be approximately computed using a Monte Carlo approximation, as follows. We note first that I E X 2 cos X 2 where X large n, the integral I is approximately equal to Mn Ti, with X1 X2 i.i.d. Exponential 25. i cos X 2 X 2 i Now, we know from Section 2.10 that we can simulate X setting X we obtain an algorithm for approximating the integral I, as follows. ln U 25 where U Exponential 25 by Uniform[0 1]. Hence, putting this all together, Exponential 25. Hence, for Tn n,
where T1 1. Select a large positive integer n. 2. Obtain Ui Uniform[0 1], independently for i 1 2 n. 3. Set Xi ln Ui 25, for i 1 2 n. 4. Set Ti i cos X 2 X 2 i, for i 1 2 n. 5. Estimate I by Mn T1 Tn n. Chapter 4: Sampling Distributions and Limits 227 For large enough n, this algorithm will provide a good estimate of the integral I. For example, the following table records the estimates Mn and the intervals (4.4.4) based on samples of Exponential 25 variables for various choices of n n 103 104 105 Mn 3 33846 3 29933 3 20629 10 3 10 3 10 3 3S Mn 2 63370 3 06646 3 13759 n 10 3 10 3 10 3 3S Mn 4 04321 3 53220 3 27499 n 10 3 10 3 10 3 From this we can see that the value of I is approximately 3 20629 true value is almost certainly in the interval 3 13759 10 3 3 27499 10 3 and that the 10 3. EXAMPLE 4.5.5 Suppose we want to evaluate the sum S j 2 3 75 j j 0 Though this is very difficult to compute directly, it can be approximately computed using a Monte Carlo approximation. Let us rewrite the sum as We then see that S 5 4 E X 2 3 7 where X Geometric 4 5. Now, we know from Section 2.10 that we can simulate X setting X where U value. Hence, we obtain an algorithm for approximating the sum S, as follows. ln 1 U ln 1 Uniform[0 1] and where or, equivalently, X Geometric 4 5 by 4 5, means to round down to the next integer ln U ln 1 4 5 1. Select a large positive integer n. 2. Obtain Ui Uniform[0 1], independently for i 1 2 n. 3. Set Xi ln Ui ln 1 4 5, for i 1 2 n. 4. Set Ti X 2 i 3 7, for i 1 2 n. 5. Estimate S by Mn 5 4 T1 Tn n. For large enough n, this algorithm will provide a good estimate of the sum S. For example, the following table records the estimates Mn and the intervals (4.4.4) based on samples of Geometric
4 5 variables for various choices of n n 103 104 105 Mn 4 66773 4 73538 4 69377 10 4 10 4 10 4 3S Mn 4 47078 4 67490 4 67436 n 10 4 10 4 10 4 3S Mn 4 86468 4 79586 4 71318 n 10 4 10 4 10 4 228 Section 4.5: Monte Carlo Approximations From this we can see that the value of S is approximately 4 69377 true value is almost certainly in the interval 4 67436 10 4 4 71318 10 4 and that the 10 4. Note that when using a Monte Carlo approximation, it is not necessary that the range of an integral or sum be the entire range of the corresponding random variable, as follows. EXAMPLE 4.5.6 Suppose we want to evaluate the integral J 0 sin x e x2 2 dx Again, this is extremely difficult to evaluate exactly. Here J 2 E sin X I X 0 where X know from Section 2.10 that we can simulate X N 0 1 and I X 0 is the indicator function of the event X N 0 1 by setting 0. We X 2 log 1 U cos 2 V where U and V are i.i.d. Uniform[0 1]. Hence, we obtain the following algorithm for approximating the integral J. 1. Select a large positive integer n. 2. Obtain Ui Vi Uniform[0 1], independently for i 1 2 n. 3. Set Xi 2 log 1 Ui cos 2 Vi, for i 1 2 n. 4. Set Ti sin Xi I Xi 0, for i 1 2 sin Xi if Xi 0, otherwise set Ti n. (That is, set Ti 0.) 5. Estimate J by Mn 2 T1 Tn n. For large enough n, this algorithm will again provide a good estimate of the integral I. For example, the following table records the estimates Mn and the intervals (4.4.4) based on samples of N 0 1 variables for various choices of n n 103 104 105 Mn 0 744037 0 733945 0 722753 Mn 3S 0 657294 0 706658 0 714108 n Mn 3S 0 830779 0 761233 0 731398 n From this we can see that the value of J is approximately 0 722753 and that the true value is almost certainly in the interval 0 714108 0 731398. Now
we consider an important problem for statistical applications of probability theory. Chapter 4: Sampling Distributions and Limits 229 EXAMPLE 4.5.7 Approximating Sampling Distributions Using Monte Carlo Xn is an i.i.d. sequence from the probability measure P We want Suppose X1 X2 to find the distribution of a new random variable Y for some function h Provided we can generate from P, then Monte Carlo methods give us a way to approximate this distribution. h X1 X2 Xn Denoting the cumulative distribution function of Y by FY we have FY y P y E PY I y] Y E I y] h X1 X2 Xn So FY y can be expressed as the expectation of the random variable I y] h X1 X2 Xn based on sampling from P To estimate this, we generate N samples of size n Xi1 Xi2 Xi n 1 N from P (note N is the Monte Carlo sample size and can be varied, for i whereas the sample size n is fixed here) and then calculate the proportion of values h Xi1 Xi2 y The estimate MN is then given by Xi n FY y 1 N N I i 1 y] h Xi1 Xi2 Xi n By the laws of large numbers, this converges to FY y as N error in this approximation, we use (4.4.3), which now takes the form To evaluate the FY y 3 FY y 1 FY y n FY y 3 FY y 1 FY y n We presented an application of this in Example 4.4.7. Note that if the base of a rec­ then the height of this rectan­ a This can be ex­ a a which converges to FY b This proves that the areas of the rectangles in the histogram converge to tangle in the histogram of Figure 4.4.2 is given by a b] gle equals the proportion of values that fell in a b] times 1 b b pressed as FY b as N FY b FY a as N FY a FY a b More generally, we can approximate an expectation E g Y using the average 1 N N i 1 g h Xi1 Xi2 Xin By the laws of large numbers, this average converges to E g Y as N Typically, there is more than one possible Monte Carlo algorithm for estimating a quantity of interest. For example, suppose we want to approximate the integral b a g x dx where we assume this integral is fin