<<

R ∞ and both have to be finite for the integral −∞ to exist. Improper integrals with infinite limits of in- tegration can be evaluated by taking limits. For example, Expectation and for continuous Z ∞ Z b random variables xf(x) dx = lim xf(x) dx. Math 217 Probability and Statistics 0 b→∞ 0 Prof. D. Joyce, Fall 2014 R ∞ The value of the integral −∞ xf(x) dx can be in- terpreted as the x-coordinate of the center of grav- Today we’ll look at expectation and variance for ity of the plane region between the x-axis and the continuous random variables. We’ll see most every- curve y = f(x). It is the point on the x-axis where thing is the same for continuous random variables that region will balance. You may have studied as for discrete random variables except integrals are centers of gravity when you took calculus. used instead of summations.

Expectation for continuous random vari- Properties of expectation for continuous ran- ables. Recall that for a discrete dom variables. They are the same as those for X, the expectation, also called the discrete random variables. and the was defined as First of all, expectation is linear. If X and Y are two variables, independent or not, then X µ = E(X) = P (X = x). x∈Sx E(X + Y ) = E(X) + E(Y ). For a continuous random variable X, we now define If c is a constant, then the expectation, also called the expected value and the mean to be E(cX) = c E(X). Z ∞ µ = E(X) = xf(x) dx, −∞ Linearity of expectation follows from linearity of integration. where f(x) is the probability density function for Next, if Y is a function of X, Y = φ(X), then X. If f(x) is 0 outside an interval [a, b], then the integral is the same as Z ∞ E(Y ) = E(φ(X)) = φ(x)f(x) dx. Z b −∞ µ = E(X) = xf(x) dx. a Next, if X and Y are independent random vari- ables, then When f(x) takes nonzero values on all of R, then R ∞ the limits of integration have to be −∞, and this is an improper integral. An improper integral of this E(XY ) = E(X) E(Y ). form is defined as a sum of two improper integrals The proof isn’t hard, but it depends on some con- Z 0 Z ∞ cepts we haven’t discussed yet. I’ll record it here xf(x) dx + xf(x) dx, and we’ll look at it again after we’ve discussed joint −∞ 0

1 distributions. Thus, the mean is just where we expect it to be, Z ∞ Z ∞ right in the middle of the interval [a, b]. E(XY ) = xyfXY (x, y) dy dx For the variance of X, let’s use the formula x→−∞ y→−∞ 2 2 Z ∞ Z ∞ Var(X) = E(X ) − µ , so we’ll need to compute 2 = xyfX (x)fY (y) dy dx E(X ). −∞ −∞ Z ∞ Z ∞ Z b 1 = xfX (x) yfY (y) dy dx E(X2) = x2 dx −∞ −∞ a b − a Z ∞ Z ∞ b = yfY (y) dy xfX (x) dx 1 3 = x −∞ −∞ 3(b − a) = E(Y ) E(X) a b3 − a3 = 3(b − a) Variance and for continu- 1 2 2 ous random variables. When we discussed vari- = 3 (a + ab + b ) ance σ2 = Var(X) for discrete random variables, it Therefore, the variance is was defined in terms of expectation, so we can use the exact same definition and the same results hold. Var(X) = E(X2) − µ2 σ2 = Var(X) = E((X − µ)2) = E(X2) − µ2 1 2 2 1 2 = 3 (a + ab + b ) − 4 (a + b) 2 1 2 Var(cX) = c Var(X) = 12 (b − a) Var(X + c) = Var(X) Since the variance is σ2 = 1 (b − a)2, therefore the 12 √ If X and Y are independent random variables, then standard deviation is σ = (b − a)/ 12. Var(X + Y ) = Var(X) + Var(Y ). The proof of that last result depends on joint dis- The mean and variance of an exponential dis- tributions, so we’ll put it off until later. tribution. For a second example, let X be expo- Of course, standard deviation is still defined as nentially distributed with parameter λ so that the −λx the square root of variance. probability density function is f(x) = λe . The mean is defined as The mean and variance of a uniform contin- Z ∞ −λx uous random variable. We’ll work this out as µ = E(X) = xλe dx. 0 an example, the easiest one to do. Let X be uniform on the interval [a, b]. Then Using integration by parts or tables, you can show 1 that f(x) = for x ∈ [a, b]. Z b − a λxe−λx dx = −xe−λx − 1 e−λx, The mean of X is λ Z b 1 µ = E(X) = x dx so, when we evaluate that from 0 to ∞, we get b − a 1 1 a (−0 − 0) − (−0 − λ ) = λ . Thus, the mean is µ = b 1 . Thus, the expected time to the next event in 1 2 λ = x 2(b − a) a Poisson process is the reciprocal of the rate of a events. b2 − a2 = Now for the variance σ2. Let’s compute E(X2). 2(b − a) Z ∞ 2 2 −λx = 1 (a + b) That’s E(X ) = x λe dx. Using integration 2 0

2 by parts twice or tables, you can show that Z 2 −λx 2 −λx 1 −λx 1 −λx λx e dx = −x e − λ 2xe − λ2 2e , and that evaluates from 0 to ∞ as 2/λ2. Therefore, the variance is 2 1 1 σ2 = E(X2) − µ2 = − = . λ2 λ2 λ2

The lack of a mean and variance for a Cauchy distribution. Not every distribution has a mean and variance. We’ll see in a minute that the Cauchy distribution doesn’t. There are also distributions that have but not , or, you could say, their variances are infinite. The will require that the distribution in ques- tion does have both a mean and variance. Let’s try to compute the mean of a Cauchy dis- tribution and see what goes wrong. It’s density is 1 f(x) = for x ∈ R. So its mean should π(1 + x2) be Z ∞ x dx µ = E(X) = 2 −∞ π(1 + x ) In order for this improper integral to exist, we need R 0 R ∞ both integrals −∞ and 0 to be finite. Let’s look at the second integral. Z ∞ ∞ x dx 1 2 2 = log(1 + x ) = ∞ 0 π(1 + x ) 2π 0 R 0 Similarly, the other integral, −∞, is −∞. Since R ∞ they’re not both finite, the integral −∞ doesn’t exist. In other words ∞ − ∞ is not a number. Thus, the Cauchy distribution has no mean. What this means in practice is that if you take a sample x1, x2, . . . , xn from the Cauchy distribution, then the average x does not tend to a particular number. Instead, every so often you will get such a huge number, either positive or negative, that the average is overwhelmed by it. A computation of its variance of a Cauchy distri- bution shows that’s infinite, too.

Math 217 Home Page at http://math.clarku. edu/~djoyce/ma217/

3