1036: probability & statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/lecture...

26
Prob. & Stat. Lecture04 - mathematical expectation ([email protected]) 4-1 1036: Probability & Statistics 1036: Probability & 1036: Probability & Statistics Statistics Lecture 4 Lecture 4 Mathematical Mathematical Expectation Expectation

Upload: others

Post on 29-Sep-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-1

1036: Probability & Statistics

1036: Probability & 1036: Probability & StatisticsStatistics

Lecture 4 Lecture 4 –– Mathematical Mathematical ExpectationExpectation

Page 2: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-2

Mean of a Random Variable• Let X be a random variable with probability

distribution f (x). The mean or expected value of Xis

• Example: – If 2 coins are tossed 16 times. The outcomes are 0 head:

4 times; 1 head: 7 times; 2 heads: 5 times. The average number of heads per toss?

( ) ∑==x

xxfXE )(µ

( ) ∫∞

∞−

== dxxxfXE )(µ

if X is discrete, and

if X is continuous

06.1165)2(

167)1(

164)0(

16)5)(2()7)(1()4)(0(

=⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛=

++

Page 3: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-3

Example 4.3• Let X be the random variables that denotes the life in

hours of a certain electronic device. The probability density function is

Find the expected life of this type of device.Solution

⎪⎩

⎪⎨⎧ >=

eleswhere,0

100,000,20)( 3 x

xxf

( ) 20020000

1003 === ∫

dxx

xXEµ

Page 4: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-4

Expectation of g (x)• Let X be a random variable with probability distribution f (x).

The mean or expected value of the random variable g (x) is

∑∞

∞−

==

==

dxxfxgXgE

xfxgXgE

Xg

Xg

)()()]([

)()()]([

)(

)(

µ

µ If X is discrete

If X is continuous

Ex: X is a RV with pdf:elsewhere

2x1-

,0

,3)(

2<<

⎪⎩

⎪⎨⎧

=x

xf

The mean of g(X)=4X+3???

[ ] ( ) 83

34)()(342

1

2=∫ +=∫=+

∞−dxxxdxxfxgXE

Page 5: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-5

Expectation of g (X,Y)• Let X and Y be two random variables with joint probability

distribution f (x, y). The mean or expected value of the random variable g (X,Y) is

∫ ∫

∑∑∞

∞−

∞−

===

==

dxdyyxfyxgYXgE

yxfyxgYXgE

YXg

x yYXg

),(),()],([

),(),()],([

),(

),(

µ

µ If X,Y are discrete

If X,Y are continuous

Ex: Find E(Y/X) for the density function( )

elsewhere10,20

,0

,431

),(2

<<<<

⎪⎩

⎪⎨⎧ +

=yxyx

yxf

( )85

431 21

0

2

0

=+

⋅=⎟⎠⎞

⎜⎝⎛ ∫ ∫ dxdyyx

xy

XYESol:

Page 6: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-6

Example • Let X and Y be random variables with joint density

function

elsewhere.1y1,0x0

,0

,4),(

<<<<

⎩⎨⎧

=xy

yxf

Find the expected value of 22 YXZ +=

( ) ∫ ∫ ∫∫∞

∞−

∞−

=+==1

0

1

0

22 4),( xydxdyyxdxdyyxzfZE

Solution:

Page 7: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-7

Remark

( )⎪⎩

⎪⎨

∫ ∫=∫

∑ ∑=∑∑=∑

= ∞

∞−

∞−

∞−dxxxgdxdyyxxf

xxgyxfxyxxfXE

x xyxy

)(),(

)(),(),( discrete

continuous

( )⎪⎩

⎪⎨

∫ ∫=∫

∑ ∑=∑∑=∑

= ∞

∞−

∞−

∞−dyyyhdxdyyxxf

yyhyxfyyxyfYE

x yxyy

)(),(

)(),(),(

E(X) & E(Y) calculated by joint pdf or marginal pdf

discrete

continuous

Page 8: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-8

Why Variance• To measure the variability !!• The mean of a random variable X (in statistics) describes where

the probability distribution is centered.

• The mean does not give adequate description of the shape of the distribution.

x x

2 2

f(x) f(x)

Page 9: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-9

Variance and Standard Deviation• Let X be a random variables with probability distribution

f (x) and mean µ. The variance of X is

• The positive square root of the variance, σ, is called the standard deviation of X

• The quantity x−µ is called the deviation of an observationfrom its mean.

( )[ ] ( )∑ −=−=x

xfxXE )(222 µµσ

( )[ ] ( )∫∞

∞−

−=−= dxxfxXE )(222 µµσ

If X is discrete

If X is continuous

Page 10: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-10

Example 4.8• Let X, a random variable, represent the number of

automobiles that are used for official business purpose on any given weekday. We have the following distributions:

x

f(x)

1 2 3

0.3 0.4 0.3

for company B

x

f(x)

1 2 3

0.2 0.1 0.3

0

0.1

4

0.1

for company A

µ=E(X)=(1)(0.3)+(2)(0.4)+(3)(0.3)=2.0Company A

( )[ ] ( ) 6.0)(23

1

222 =−=−= ∑=

xfxXEx

µσ

Company B: 2)( =XE ( )[ ] 6.122 =−= µσ XE

Page 11: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-11

Variance[ ] 222 µσ −= XE

22

22

22

2222

)( 2)(

)()(2)(

)()2()()(

µ

µµµ

µµ

µµµσ

−=

+⋅−=

+−=

+−=−=

∑∑∑

∑∑

XEXE

xfxxfxfx

xfxxxfx

xxx

xx

Proof:This often simplifies the calculation

Page 12: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-12

Example 4.10• X is a random variable with the pdf

( )elsewhere.

2x1

,0,12

)(<<

⎩⎨⎧ −

=x

xf

Mean & variance?

( )3512)()(

2

1

=−=== ∫∫∞

∞−

dxxxdxxxfXEµ

617)()( 22 == ∫

∞−

dxxfxXE

[ ] 18/1222 =−= µσ XE

Page 13: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-13

Remarks• Let X be a random variable with probability distribution f(x).

The variance of the random variable g(X) is

• Since g(X) is itself a random variable with mean µg(X)

( )[ ] [ ] )()()( 2)(

2)(

2)( xfxgXgE

xXgXgXg ∑ −=−= µµσ

( )[ ] [ ]∫∞

∞−

−=−= dxxfxgXgE XgXgXg )()()( 2)(

2)(

2)( µµσ

If X is discrete

If X is continuous

Page 14: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-14

Example 4.11• Calculate the variance of g(X)=2X+3, where X is a

random variable with probability distribution:x

f(x)0

1/4

11/8

21/2

31/8

( ) 6)(32)32(3

0)( =+=+= ∑

=xXg xfxXEµ

( )[ ] ( ) 4)(632)(3

0

22)(

2)( =−+=−= ∑

=xXgXg xfxXgE µσ

Solution

Page 15: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-15

Covariance• Let X and Y be random variables with joint probability

distribution f (x,y). The covariance of X and Y is

• When X and Y are statistically independently, σXY = 0. – The inverse is not generally true

• The sign of the covariance indicates whether the relationship between two dependent random variables is positive or negative.

( )( )[ ] ( )( )∑∑ −−=−−=x y

YXYXXY yxfyxYXE ),(µµµµσ

( )( )[ ] ( )( )∫ ∫∞

∞−

∞−

−−=−−= dxdyyxfyxXXE YXYXXY ),(µµµµσ

If discrete

If continuous

Page 16: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-16

CovarianceYXXY XYE µµσ −= )(

YX

YXYXYX

x y x yYXY

x y x yX

x yYXYX

x yYXXY

YXEYXE

yxfyxxf

yxyfyxxyf

yxfxyxy

yxfyx

µµµµµµµµ

µµµ

µ

µµµµ

µµσ

−=+−−=

+−

−=

+−−=

−−=

∑∑ ∑∑

∑∑ ∑∑

∑∑

∑∑

),( ),(

),(),(

),(),(

),()(

),())((Proof:

This often simplifies the calculation

Page 17: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-17

Example 4.14• The fraction X of male runners and the fraction Y of female

runners who compete in marathon races is described by the joint density function

elsewhere010

,0

,8),(

xy,xxyyxf

≤≤≤≤

⎩⎨⎧

=

∫∞

∞−

== dxxxgXEX )()(µ elsewhere10

0

4),()(

3 ≤≤

⎩⎨⎧

== ∫∞

∞−

xxdyyxfxg

∫∞

∞−

== dyyyhYEY )()(µ ( )elsewhere

10

014

),()(2 ≤≤

⎩⎨⎧ −

== ∫∞

∞−

yyydxyxfyh

( ) 255/4=−= YXXY XYE µµσ

Find the covariance of X and Y

Sol.

Page 18: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-18

Correlation Coefficient• The covariance does not indicate anything regarding the

strength of the relationship, since the value σXY is not scale free, which depends on the units measured for both X and Y.

• Let X and Y be random variables with covariance σXY and standard deviations σX and σY, respectively. The correlation coefficient X and Y is

YX

XYXY σσ

σρ =

11 ≤≤− XYρ

0=XYρ

X & Y linear dependence, i.e.Y=a+bX

X & Y independent

1±=XYρ

Page 19: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-19

Linear Combinations of RVs.• If a and b are constant, then E(aX±b)=aE(X)±bProof.

• If b is constant, then E(b)=b• If a is constant, then E(aX)=aE(X)

• The expected value of the sum or difference of two or more functions of a random variable X is the sum or difference of the expected values of the functions.

[ ] [ ] [ ])()()()( XhEXgEXhXgE ±=±

Page 20: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-20

Linear Functions of RVs• The expected value of the sum or difference of two or more

functions of random variable X and Y is the sum or difference of the expected values of the functions.

[ ] [ ] [ ]),(),(),(),( YXhEYXgEYXhYXgE ±=±

[ ] [ ]

[ ] [ ]),(),(

),(),(),(),(

),(),(),(),(),(

YXhEYXgE

dxdyyxfyxhdxdyyxfyxg

dxdyyxfyxhyxgYXhYXgE

±=

±=

±=±

∫ ∫∫ ∫

∫ ∫∞

∞−

∞−

∞−

∞−

∞−

∞−

)]([)]([)]()([ YhEXgEYhXgE ±=±•

Page 21: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-21

Theorem 4.8• Let X and Y be two independent random variables. Then

)()()( YEXEXYE =

)()(

)()(),()(

YEXE

dxdyygxxyhdxdyyxxyfXYE

=

== ∫ ∫∫ ∫∞

∞−

∞−

∞−

∞−

Page 22: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-22

Linear Combinations of RVs.• If a and b are constant, then Proof.

• If b is constant, then • If a is constant, then

• If X and Y are random variables with joint probability distribution f (x,y), then

XYYXbYaX abba σσσσ 222222 ±+=±

222XbaX a σσ =+

22XbX σσ =+

222XaX a σσ =

XYYX

YXYX

YX

YXbYaX

abba

YXabEba

YbXaE

babYaXE

σσσ

µµσσ

µµ

µµσ

2

)])([(2

})]()({[

})](){[(

2222

2222

2

22

±+=

−−±+=

−±−=

±−±=±Proof

Page 23: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-23

Remarks• If X and Y are independent, then

• If X and Y are independent, then

• If X1, X2, …, Xn are independent

22222YXbYaX ba σσσ +=±

22222

221

2212211 nnn XnXXxaxaxa aaa σσσσ +++=+++ LL

0=XY

σ

Page 24: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-24

Variance ?• If a random variable has a small variance, we would expect

most of the values to be grouped around the mean.• A large value of σ indicates a greater variability and,

therefore, we would expect the spread distribution.• Since the total area under a probability distribution curve is

1, the area between any two numbers is then the probability of the random variable assuming a value between these numbers.

• Chebyshev (1821--1894) discovered that the fraction of the area between any two values symmetric about the mean is related to the standard deviation.

Page 25: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-2522

22222

1)(1)()(

)()( isThat

kkxP

kdxxfdxxf

dxxfkdxxfk

k

k

k

k

≤≥−⇔≤+⇒

+≥

∫∫

∫∫∞

+

∞−

+

∞−

σµ

σσσ

σµ

σµ

σµ

σµ

Chebyshev’s Theorem• The probability that any random variable X will assume a

value within k standard deviations of the mean is at least 1−1/k2. That is

Proof

( ) 2

11k

kXP −≥<− σµ

)(y probabilit heconsider tfirst We σµ kXP ≥−

∫∫∫∞

+

∞−

∞−

−+−≥−=σµ

σµ

µµµσk

k

dxxfxdxxfxdxxfx )()()()()()( 2222

∫∫∞

+

∞−

+≥σµ

σµ

σσk

k

dxxfkdxxfk )()( 2222

Page 26: 1036: Probability & Statisticstwins.ee.nctu.edu.tw/courses/prob06/lectures/Lecture 04-mathemati… · Why Variance • To measure the variability !! • The mean of a random variable

Prob. & Stat. Lecture04 - mathematical expectation ([email protected])

4-26

Chebyshev’s Theorem• ¾ or more of the observations of any distribution lie in the

interval µ±2σ (1-1/22 = ¾ ), lower bound only (weak result)• The use of Chebyshev’s theorem is relegated to situations

where the form of the distribution is unknown.

Example 4.22 X a RV, with mean of 8 and variance of σ2=9,

( ) [ ] 2411)3)(4(8)3)(4(8204 . −≥+<<−=<<− XPXPa

µ σk µ σk

( ) ( )( ) ( )

4/1)211(1

)3)(2(8)3)(2(816861 68168 .

2 =−−≤

+<<−−=<−<−−=

<−−=≥−

XPXPXPXPb