3 5 3 6 expected values and variance
play

3.53.6 Expected values and variance Prof. Tesler Math 186 Winter - PowerPoint PPT Presentation

3.53.6 Expected values and variance Prof. Tesler Math 186 Winter 2019 Prof. Tesler 3.53.6 Expected values and variance Math 186 / Winter 2019 1 / 24 Expected Winnings in a Game Setup A simple game: Pay $1 to play once. 1 Flip two


  1. 3.5–3.6 Expected values and variance Prof. Tesler Math 186 Winter 2019 Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 1 / 24

  2. Expected Winnings in a Game Setup A simple game: Pay $1 to play once. 1 Flip two fair coins. 2 Win $5 if HH, nothing otherwise. 3 � $ 5 with probability 1 / 4 ; The payoff is X = $ 0 with probability 3 / 4 . The net winnings are � $ 5 − $ 1 = $ 4 with probability 1 / 4 ; Y = X − 1 = $ 0 − $ 1 = − $ 1 with probability 3 / 4 . Playing the game once is called a trial. Playing the game n times is an experiment with n trials. Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 2 / 24

  3. Expected Winnings in a Game Average payoff If you play the game n times, the payoff will be $5 about n / 4 times and $0 about 3 n / 4 times, totalling $ 5 · n / 4 + $ 0 · 3 n / 4 = $ 5 n / 4 The expected payoff (long term average payoff) per game is obtained by dividing by n : E ( X ) = $ 5 · 1 / 4 + $ 0 · 3 / 4 = $ 1 . 25 For the expected winnings (long term average winnings), subtract off the bet: E ( Y ) = E ( X − 1 ) = $ 4 · 1 / 4 − $ 1 · 3 / 4 = $ 0 . 25 That’s good for you and bad for the house. A fair game has expected winnings = $0. A game favors the player if the expected winnings are positive. A game favors the house if the expected winnings are negative. Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 3 / 24

  4. Expected Value of a Random Variable (Technical name for long term average) The expected value of a discrete random variable X is � E ( X ) = x · p X ( x ) x The expected value of a continuous random variable X is � ∞ E ( X ) = x · f X ( x ) dx − ∞ E ( X ) is often called the mean value of X and is denoted µ (or µ X if there is more than one random variable in the problem). µ doesn’t have to be a value in the range of X . The previous example had range X = $ 0 or $ 5 , and mean $ 1 . 25 . Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 4 / 24

  5. Expected Value of Binomial Distribution Consider a biased coin with probability p = 3 / 4 for heads. Flip it 10 times and record the number of heads, x 1 . Flip it another 10 times, get x 2 heads. Repeat to get x 1 , · · · , x 1000 . Estimate the average of x 1 , . . . , x 1000 : 10 ( 3 / 4 ) = 7 . 5 (Later we’ll show E ( X ) = np for the binomial distribution.) An estimate based on the pdf: About 1000 p X ( k ) of the x i ’s equal k for each k = 0 , . . . , 10 , so 1000 10 � � k · 1000 p X ( k ) x i 10 � i = 1 k = 0 average of x i ’s = = k · p X ( k ) 1000 ≈ 1000 k = 0 which is the formula for E ( X ) in this case. Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 5 / 24

  6. Interpretation of the word “Expected” Although E ( X ) = 7 . 5 , this is not a possible value for X . Expected value does not mean we anticipate observing that value. It means the long term average of many independent measurements of X will be approximately E ( X ) . Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 6 / 24

  7. Function of a Random Variable Let X be the value of a roll of a biased die and Z = ( X − 3 ) 2 . z = ( x − 3 ) 2 p X ( x ) p Z ( z ) x 1 q 1 4 2 q 2 1 p Z ( 0 ) = q 3 3 q 3 0 p Z ( 1 ) = q 2 + q 4 4 q 4 1 p Z ( 4 ) = q 1 + q 5 5 q 5 4 p Z ( 9 ) = q 6 6 q 6 9 pdf of X : Each q i � 0 and q 1 + · · · + q 6 = 1 . pdf of Z : Each probability is also � 0 , and the total sum is also 1 . Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 7 / 24

  8. Expected Value of a Function Let X be the value of a roll of a biased die and Z = ( X − 3 ) 2 . z = ( x − 3 ) 2 p X ( x ) p Z ( z ) x 1 q 1 4 2 q 2 1 p Z ( 0 ) = q 3 3 q 3 0 p Z ( 1 ) = q 2 + q 4 4 q 4 1 p Z ( 4 ) = q 1 + q 5 5 q 5 4 p Z ( 9 ) = q 6 6 q 6 9 E ( Z ) , in terms of values of Z and the pdf of Z , is � E ( Z ) = z · p Z ( z ) = 0 ( q 3 ) + 1 ( q 2 + q 4 ) + 4 ( q 1 + q 5 ) + 9 ( q 6 ) z Regroup it in terms of X : 6 � ( x − 3 ) 2 p X ( x ) = 4 q 1 + 1 q 2 + 0 q 3 + 1 q 4 + 4 q 5 + 9 q 6 = x = 1 Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 8 / 24

  9. Expected Value of a Function Let X be a discrete random variable, and g ( X ) be a function, such as ( X − 3 ) 2 . The expected value of g ( X ) is � E ( g ( X )) = g ( x ) p X ( x ) x For a continuous random variable, � ∞ E ( g ( X )) = g ( x ) f X ( x ) dx − ∞ Note that if Z = g ( X ) then E ( Z ) = E ( g ( X )) . Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 9 / 24

  10. Expected Value of a Continuous distribution Consider the dartboard of radius 3 example, with pdf � Probability density with 31 bins if 0 � r � 3 ; 2 r / 9 f R ( r ) = 0.8 otherwise. 0 Probability density Throw n darts and make a 0.6 histogram with k bins. 0.4 r 1 , r 2 , . . . are representative values of R in each bin. 0.2 The bin width is ∆ r = 3 / k , the height is ≈ f R ( r i ) , 0 and the area is ≈ f R ( r i ) ∆ r . 0 1 2 3 The approximate number of darts in bin i is n f R ( r i ) ∆ r . Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 10 / 24

  11. Expected Value of a Continuous Distribution The estimated average radius is � i r i · n f R ( r i ) ∆ r � = r i · f R ( r i ) ∆ r n i As n , k → ∞ , the histogram smoothes out and this becomes � 3 r · f R ( r ) dr 0 Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 11 / 24

  12. Mean of a continuous distribution Consider the dartboard of radius 3 example, with pdf � if 0 � r � 3 ; 2 r / 9 f R ( r ) = otherwise. 0 The “average radius” (technically the mean radius or expected value of R ) is � 3 � 3 � ∞ 2 r 2 r · 2 r µ = E ( R ) = r · f R ( r ) dr = 9 dr = 9 dr 0 0 − ∞ 3 = 2 ( 3 3 − 0 3 ) 2 r 3 � � = = 2 � 27 27 � 0 Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 12 / 24

  13. Expected Values — Properties The gambling slide earlier had E ( X − 1 ) = E ( X ) − 1 . Theorem where a , b are constants. E ( aX + b ) = aE ( X ) + b Proof (discrete case). � E ( aX + b ) = ( ax + b ) · p X ( x ) x � � = x · p X ( x ) + b p X ( x ) a x x = a · E ( X ) + b · 1 = aE ( X ) + b � Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 13 / 24

  14. Expected Values — Properties The gambling slide earlier had E ( X − 1 ) = E ( X ) − 1 . Theorem where a , b are constants. E ( aX + b ) = aE ( X ) + b Proof (continuous case). � ∞ E ( aX + b ) = ( ax + b ) · f X ( x ) dx − ∞ � ∞ � ∞ = x · f X ( x ) dx + b f X ( x ) dx a − ∞ − ∞ = a · E ( X ) + b · 1 = aE ( X ) + b � Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 14 / 24

  15. Expected Values — Properties These properties hold for both discrete and continuous random variables: for any constants a , b . E ( aX + b ) = a E ( X ) + b E ( aX ) = a E ( X ) E ( b ) = b � � g ( X ) + h ( X ) = E ( g ( X )) + E ( h ( X )) E Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 15 / 24

  16. Variance These distributions both have mean=0, but the right one is more spread out. 0.1 0.1 pdf pdf 0.05 0.05 0 0 ! 20 0 20 ! 20 0 20 x x The variance of X measures the square of the spread from the mean: σ 2 = Var ( X ) = E ( X − µ ) 2 � � � The standard deviation of X is σ = Var ( X ) and measures how wide the curve is. Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 16 / 24

  17. Variance � ( X − µ ) 2 � The same definition Var ( X ) = E is used for both the discrete and continuous cases, but expected value is computed differently in the two cases. � � Why don’t we use E ( X − µ ) or E | X − µ | to measure the spread? E ( X − µ ) = E ( X ) − µ = µ − µ = 0 , so it doesn’t measure the spread. Both | X − µ | and ( X − µ ) 2 are nonnegative. � ( X − µ ) 2 � We will see that E leads to useful properties. � � It turns out that E does not have nice properties. | X − µ | Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 17 / 24

  18. Variance formula σ 2 = E � ( X − µ ) 2 � Consider the dartboard of radius 3 example, with pdf � if 0 � r � 3 ; 2 r / 9 f R ( r ) = otherwise. 0 µ = 2 from earlier slide. σ 2 = Var ( R ) � ( R − µ ) 2 � � ( R − 2 ) 2 � = E = E � 3 � ∞ ( r − 2 ) 2 · 2 r ( r − 2 ) 2 f R ( r ) dr = = dr 9 0 − ∞ � r 4 � 3 2 r 3 − 8 r 2 + 8 r 3 18 − 8 r 3 27 + 4 r 2 �� � = dr = � 9 9 � 0 � 3 4 0 18 − 8 ( 3 3 ) + 4 ( 3 2 ) � − 0 = 1 = 27 9 2 Variance: σ 2 = 1 � Standard deviation: σ = 1 / 2 2 Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 18 / 24

  19. Variance — Second formula There are two equivalent formulas to compute variance. In any problem, choose the easier one: σ 2 = Var ( X ) ( X − µ ) 2 � � (Definition) = E E ( X 2 ) − µ 2 (Sometimes easier to compute) = Proof. ( X − µ ) 2 � � Var ( X ) = E E ( X 2 − 2 µ X + µ 2 ) = E ( X 2 ) − 2 µ E ( X ) + µ 2 = E ( X 2 ) − 2 µ 2 + µ 2 = E ( X 2 ) − µ 2 = � Prof. Tesler 3.5–3.6 Expected values and variance Math 186 / Winter 2019 19 / 24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend