21
Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation Chapter 2 Transformations and Expectations Expected Values 1 / 21

Chapter 2 Transformations and Expectations

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Chapter 2Transformations and Expectations

Expected Values

1 / 21

Page 2: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Outline

Discrete Random VariablesDefinitionProperties

Bernoulli Trials

Discrete Calculus

Geometric Interpretation of Expectation

2 / 21

Page 3: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete Random VariablesLet x1, x2, · · · xn be observations, the empirical mean,

x =1

n(x1 + x2 · · ·+ xn).

So, for the observations, 0, 1, 3, 2, 4, 1, 2, 4, 1, 1, 2, 0, 3, x = 24/13.

We could also organize these observations taking advantage of the distributive propertyof the real numbers, compute x as follows

x n(x) xn(x)0 2 01 4 42 3 63 2 64 2 8

13 24

3 / 21

Page 4: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete Random VariablesFor h(x) = x2, we can perform a similar computation:

x h(x) = x2 n(x) h(x)n(x)

0 0 2 01 1 4 42 4 3 123 9 2 184 16 2 32

13 66

Then,

h(x) =1

n

x

h(x)n(x)=∑

x

h(x)p(x) =66

13.

where

p(x) =n(x)

nfor the proportion of observations equal to x .

4 / 21

Page 5: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Definition

In analogy for the mean from a set of observations, we define, for a finite sample spaceΩ = ω1, ω2, . . . , ωN and a probability P on Ω, we can define the expectation or theexpected value of a random variable X by an analogous average,g(X ) by an analogousaverage,

EX =N∑

j=1

X (ωj)Pωj.

Eg(X ) =N∑

j=1

g(X (ωj))Pωj.

5 / 21

Page 6: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Definition

Roll one die. Then Ω = 1, 2, 3, 4, 5, 6. Let X be the value on the die. So, X (ω) = ω.If the die is fair, then the probability model has Pω = 1/6 for each outcome ω. Anexample of an unfair dice would be the probability with P1 = P2 = P3 = 1/12and P4 = P5 = P6 = 1/4.

ω X (ω) Pω X (ω)Pω Pω X (ω)Pω1 1 1/6 1/6 1/12 1/122 2 1/6 2/6 1/12 2/123 3 1/6 3/6 1/12 3/124 4 1/6 4/6 3/12 12/125 5 1/6 5/6 3/12 15/126 6 1/6 6/6 3/12 18/12

sum 1 EX = 21/6 = 7/2 1 EX = 51/12 = 17/4

6 / 21

Page 7: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

PropertiesTwo properties of expectation are immediate from the formula

EX =∑

ω

X (ω)Pω.

1. If X (ω) ≥ 0 for every outcome ω ∈ Ω, then every term in the sum is nonnegativeand consequently their sum EX ≥ 0.

2. Let X1 and X2 be two random variables and c1, c2 be two real numbers, then byusing g(x1, x2) = c1x1 + c2x2 and the distributive property, we find out that

E [c1X1 + c2X2] = c1EX1 + c2EX2.

Taking these two properties, we say that the operation of taking an expectation

X 7→ EX

is a positive linear functional.7 / 21

Page 8: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete Random Variables

Example. Toss a coin three times and X denote the number of heads.

A B C D E F G

ω X (ω) x Pω PX = x X (ω)Pω xPX = xHHH 3 3 PHHH PX = 3 X (HHH)PHHH 3PX = 3HHT 2 PHHT X (HHT )PHHTHTH 2 2 PHTH PX = 2 X (HTH)PHTH 2PX = 2THH 2 PTHH X (THH)PTHHHTT 1 PHTT X (HHT )PHHTTTH 1 1 PTHT PX = 1 X (HTH)PHTH 1PX = 1THT 1 PTTH X (THH)PTHHTTT 0 0 PTTT PX = 0 X (TTT )PTTT 0PX = 0

EX = 0 · PX = 0+ 1 · PX = 1+ 2 · PX = 2+ 3 · PX = 3.

8 / 21

Page 9: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete Random VariablesTo find a similar formula for Eg(X ) for a discrete random variable X ,

A B C D E F G

ω X (ω) x Pω PX = x g(X (ω))Pω g(x)PX = x...

......

......

......

ωk X (ωk) Pωk g(X (ωk))Pωkωk+1 X (ωk+1) xi Pωk+1 PX = xi g(X (ωk+1))Pωk+1 g(xi )PX = xi

......

......

......

......

......

...

Eg(X ) = g(x1)PX = x1+ · · ·+ g(xn)PX = xn= g(x1)fX (x1) + · · ·+ g(xn)fX (xn)

Eg(X ) =∑

x

g(x)fX (x)

9 / 21

Page 10: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete Random Variables

A similar formula holds if we have a vector of random variables X = (X1,X2, . . . ,Xn),

fX (x1, x2, . . . , xn) = PX1 = x1,X2 = x2, . . . ,Xn = xn,the joint probability mass function and g a real-valued function ofx = (x1, x2, . . . , xn).

In the two dimensional case, this takes the form

Eg(X1,X2) =∑

x1

x2

g(x1, x2)fX1,X2(x1, x2).

We will return to this identity in computing the covariance of two random variables.

Exercise. Find EX 2 for both the fair dice and the unfair dice.

10 / 21

Page 11: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Bernoulli Trials

Bernoulli trials are the simplest and among the most common models for anexperimental procedure. Each trial has two possible outcomes, variously called,

heads-tails, yes-no, up-down, left-right, win-lose, female-male, green-blue, dominant-recessive,success-failure.

Random variables X1,X2, . . . ,Xn are called a sequence of Bernoulli trials provided that:

• Each Xi takes on two values, namely, 0 and 1. We call the value 1 a success andthe value 0 a failure.

• Each trial has the same probability for success, i.e., PXi = 1 = p for each i .

• The outcomes on each of the trials is independent.

11 / 21

Page 12: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Bernoulli Trials

For each trial i , the expected value

EXi = 0 · PXi = 0+ 1 · PXi = 1 = 0 · (1− p) + 1 · p = p

is the same as the success probability.

Let Sn = X1 + X2 + · · ·+ Xn be the total number of successes in n Bernoulli trials.

Using the linearity of expectation, we see that

ESn = E [X1 + X2 + · · ·+ Xn] = p + p + · · ·+ p = np,

the expected number of successes in n Bernoulli trials is np.

12 / 21

Page 13: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Bernoulli TrialsTo determine the probability mass function for Sn. Beginning with a concrete example,let n = 8, and the outcome

failure, success, failure, failure, success, failure, failure, success

Using the independence of the trials, we can compute the probability of this outcome:

(1− p)× p × (1− p)× (1− p)× p × (1− p)× (1− p)× p = p3(1− p)5.

• Any of the(83

)sequences of 8 Bernoulli trials having 3 successes also has

probability p3(1− p)5.• Each of the outcomes are mutually exclusive.• Their union is the event S8 = 3.• Consequently, by the axioms of probability,

PS8 = 3 =

(8

3

)p3(1− p)5.

13 / 21

Page 14: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Bernoulli TrialsReplace 8 by n and 3 by x to see that any sequence of n Bernoulli trials having xsuccesses has probability

px(1− p)n−x .

In addition, we know that we have (n

x

)

mutually exclusive sequences of n Bernoulli trials that have x successes. Thus, we havethe mass function

fSn(x) = PSn = x =

(n

x

)px(1− p)n−x , x = 0, 1, . . . , n.

The fact that the sumn∑

x=0

fSn(x) =n∑

x=0

(n

x

)px(1− p)n−x = (p + (1− p))n = 1n = 1

follows from the binomial theorem. Thus, Sn is called a binomial random variable 14 / 21

Page 15: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Bernoulli TrialsExercise. Let S4 be the number of successes in 4 Bernoulli trials with p = 1/3.

1. Find the mass function fS4(x), x=0,1,2,3,4.

2. Use fS4 to compute ES4.

3. Sketch the cumulative distribution function FS4 for S4.

Answer. fS4(x) =(4x

) (13

)x (23

)(4−x)

x fS4(x) xfS4(x)

0 16/81 01 32/81 32/812 24/81 48/813 8/81 24/814 1/81 4/81

108/81=4/3

15 / 21

Page 16: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete CalculusLet h be a function on whose domain and range are integers. The (positive) differenceoperator

∆+h(x) = h(x + 1)− h(x).

If we take, h(x) = (x)k = x(x − 1) · · · (x − k + 1), then

∆+(x)k = (x + 1)x · · · (x − k + 2)− x(x − 1) · · · (x − k + 1)

= ((x + 1)− (x − k + 1))(x(x − 1) · · · (x − k + 2)) = k(x)k−1.

Thus, the falling powers and the difference operator plays a role similar to the powerfunction and the derivative,

d

dxxk = kxk−1.

16 / 21

Page 17: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete CalculusTo find the analog to the integral, note that

h(n + 1)− h(0) = (h(n + 1)− h(n)) + (h(n)− h(n − 1)) + · · ·+ · · · (h(2)− h(1)) + (h(1)− h(0))

=n∑

x=0

∆+h(x).

For example,

n∑

x=1

(x)k =1

k + 1

n∑

x=1

∆+(x)k+1 =1

k + 1(n + 1)k+1.

Exercise. Use the ideas above to find the sum to a geometric series.

∆+rx = r x+1 − crn = (r − 1)rn.

17 / 21

Page 18: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Discrete CalculusExample. Let X be a discrete uniform random variable on S = 1, 2, . . . n, then

EX =n∑

x=1

x1

n=

1

n

n∑

x=1

(x)1 =1

n· (n + 1)2

2=

1

n· (n + 1)n

2=

n + 1

2.

Using the difference operator, EX (X − 1) is usually easier to determine for integervalued random variables than EX 2. In this example,

EX (X − 1) =n∑

j=1

x(x − 1)1

n=

1

n

n∑

j=2

(x)2

=1

3n

n∑

j=2

∆(x)3 =1

3n(n + 1)3 =

1

3n(n + 1)n(n − 1) =

n2 − 1

3

We can find EX 2 = EX (X − 1) + EX by using the linearity of expectation.18 / 21

Page 19: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Geometric Interpretation of Expectation

Exercise 3. Use the ideas above to find the sum to a geometric series.

Example 4. Let X be a discrete uniform random variable on S = 1, 2, . . . n, then

EX =

nX

x=1

x1

n=

1

n

nX

x=1

(x)1 =1

n· (n + 1)2

2=

1

n· (n + 1)n

2=

n + 1

2.

Using the di↵erence operator, EX(X 1) is usually easier to determine for integer valued random vari-ables than EX2. In this example,

EX(X 1) =nX

j=1

x(x 1)1

n=

1

n

nX

j=2

(x)2

=1

3n

nX

j=2

(x)3 =1

3n(n + 1)3 =

1

3n(n + 1)n(n 1) =

n2 1

3

We can find EX2 = EX(X 1) + EX by using the linearity of expectation.

1.2 Geometric Interpretation of Expectation

-

6

x1 x2 x3 x4

x1P X = x1

x2P X = x2

x3P X = x3

x4P X = x4

...

1(x1 x0)P X > x0

(x2 x1)P X > x1(x3 x2)P X > x2

(x4 x3)P X > x3 · · ·

Figure 1: Graphical illustration of EX, the expected value of X, as the area above the cumulative distributionfunction and below the line y = 1 computed two ways.

We can realize the computation of expectation for a nonnegative random variable

EX = x1PX = x1 + x2PX = x2 + x3PX = x3 + x4PX = x4 + · · ·

4

Figure: Graphical illustration of EX , the expected value of X , as the area above the cumulativedistribution function and below the horizontal line at 1 computed two ways.

19 / 21

Page 20: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Geometric Interpretation of ExpectationWe can realize the computation of expectation for a nonnegative random variable

EX = x1PX = x1+ x2PX = x2+ x3PX = x3+ x4PX = x4+ · · ·.As illustrated in the Figure, each term in this sum can be seen as a horizontalrectangle of width xj and height PX = xj.Summation by parts, the analog in calculus to integration by parts, suggests that wecan also compute this area by looking at the vertical rectangles. The j-th rectangle haswidth xj+1 − xj and height PX > xj. Thus,

EX =∞∑

j=0

(xj+1 − xj)PX > xj.

if X take values in the nonnegative integers, then xj = j and

EX =∞∑

j=0

PX > j.20 / 21

Page 21: Chapter 2 Transformations and Expectations

Discrete Random Variables Bernoulli Trials Discrete Calculus Geometric Interpretation of Expectation

Geometric Interpretation of ExpectationExample. For a geometric random variable based on the number of tails before thefirst heads from successive flips of a biased coin, we have that X > j = X ≥ j + 1precisely when the first j + 1 coin tosses results in tails. Thus,

PX > j = (1− p)j+1

and

EX =∞∑

j=0

PX > j =∞∑

j=0

(1− p)j+1 =1− p

1− (1− p)=

1− p

p.

Exercise. For a Z+ valued random variable, choose xj = (j)k to see that

E (X )k = k∞∑

j=0

(j)k−1PX > j.

21 / 21