what is a random variable?

6
1 Random Variables 2 What is a random Variable? • RV=Experiment+Measure of interest – Roullette: Experiment • Roll the ball (rien ne va plus) Measure A={A red has appeared} B ={ An Odd number has appeared} • C ={ House winns} 3 What is a random Variable? Experiment – Flip coins: Heads->+1,Tail->-1 Measure – A ={Fraction of time one is winning} – B ={Distance between zero crossings} – C ={Maximal distance to the zero point} 4 What is a random Variable? Experiment :Diffusion Process Measure A ={Maximal distance as a function of time} B={Area/Perimeter} Propagation of messages in a net 5 What is a random Variable? • Definition: In a Probability Space ( ,P), a Random Variable (rv), is a function: : X 6 Example Two players (A,B) roll two dice • Possible random variables : = = j) (i, for / ) , ( : j i j i X X A A We would like to define a probability function )) , ( ( : j i X P P A 0 1 P(.) P(.) ) , ( j i X A

Upload: others

Post on 12-Sep-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What is a random Variable?

1

1

Random Variables

2

What is a random Variable?

• RV=Experiment+Measure of interest– Roullette:– Experiment

• Roll the ball (rien ne va plus)– Measure

• A=A red has appeared• B = An Odd number has appeared• C = House winns

3

What is a random Variable?

• Experiment– Flip coins: Heads->+1,Tail->-1

• Measure– A =Fraction of time one is winning– B =Distance between zero crossings– C =Maximal distance to the zero point

4

What is a random Variable?

• Experiment :Diffusion Process

•MeasureA =Maximal distance as a function of timeB=Area/Perimeter

Propagation of messages in a net

5

What is a random Variable?

• Definition:• In a Probability Space (Ω,P), a Random

Variable (rv), is a function:

ℜ→Ω:X

6

Example

• Two players (A,B) roll two dice• Possible random variables:

=Ω Ω∈=

ℜ→Ω

j)(i,for /),(

:

jijiX

X

A

A

We would like to define a probability function

)),((:

jiXPP

A

ℜ→Ω

0 1 P(.)P(.)

),( jiX A

Page 2: What is a random Variable?

2

7

Example

• Two players (A,B) roll two dice• Possible random variables:

Ω∈

<=>

=

ℜ→Ω

j)(i,for ji if 1-ji if 0ji if 1

),(

:

jiX

X

Win

Win

Ω∈−=

ℜ→Ω

j)(i,for ),(

:

jijiX

X

Diff

Diff

0 1 P(.)P(.)

),(or ),( jiXjiX DiffWin

8

Objects that are needed

ℜ→ΩΩ

A ON FUNCTION )),(P( RV a of Prob.

SETA ON FUNCTIONSET ),( Spacey Probabilit

SETA ON FUNCTION : Variable RandomSET Space Sample

jiX

P

X

A

A

Name symbol kind of object

0 1 P(.)P(.)

ℜ∈

),( jiX A

9

Relation between objects

),( PΩ

0 1 P(.)P(.)

: ℜ→ΩAX

)),(P( jiX A

0 ℜ

),( jiXA

10

Probability of a Random Variable

• Definition: Set of probabilities associated to the values that a R.V. can take.

),( PΩ

0 1 P(.)P(.)

0 ℜ

) of ( ΩSubsetRandVar( )( ) ( ) ( )

x x

11

Example:Probability of a Random Variable

• A die is thrown twice

1/362/363/364/365/366/365/364/363/362/361/36

12111098765432

0

0,020,040,06

0,080,1

0,120,14

0,160,18

2 3 4 5 6 7 8 9 10 1 1 12

Random Value

Pro

b. o

f th

e ra

nd

om

val

ue

=Ω Ω∈+=

ℜ→Ωj)(i,for ),(

:jijiX

X

12

Example

• Game of Daniel and Nicolas Bernouilli– RV: X(HH…FFH): Fraction of time Daniel is in lead.

ℜ→Ω:X

HHHH HHHH

FHHH H H H H

HFFH FFHH

FFFF FFFF →

L

L

M

L

M

L

=Ω 0 1 X(.)X(.)

X

Page 3: What is a random Variable?

3

13

Example• Probability of X(HH…FFH):

– We compute P( X(HH…FFH)) for each

)1(1

)(xx

XP−

ℜ→Ω:X

HHHH HHHH

FHHH H H H H

HFFH FFHH

FFFF FFFF

L

L

M

L

M

L

=Ω 0 1 X(.)X(.)

X

0 1 P(X)P(X)

X

For the derivation of P(X) see Feller or Vélez

Ω∈A

14

Example• Probability of X(HH…FFH):

– RV: Fraction of time Daniel is in lead.

00,02

0,04

0,060,08

0,1

0,12

0,140,16

0,05 0,15 0,25

0,35 0,45 0,55 0,65 0,75 0,85 0,95

Fraction of time a player is in lead

Pro

b. o

f b

ein

g in

lead

a g

iven

fr

acti

on

of

tim

e

)1(1)(

:

xxXP

X

−=

ℜ→Ω

π

15

Example

• Probability of X(HH…FFH):– RV: Fraction of time Daniel is in lead.

• Note that the distribution says that Daniel with high probability either wins of losses

00,02

0,04

0,060,08

0,1

0,12

0,140,16

0,05

0,15 0,25 0,35

0,45 0,55 0,65

0,75 0,85 0,95

Fraction of time a player is in lead

Pro

b. o

f b

ein

g in

lead

a g

iven

fr

acti

on

of

tim

e

)1(1

)(

:

xxXP

X

−=

ℜ→Ω

π

16

Example

• Probability of X(HH…FFH):– Underlying mechanism.– In 20 throws the probability of a run of 5

consecutive heads or tails is much higher than intuition says

00,02

0,04

0,060,08

0,1

0,12

0,140,16

0,05

0,15 0,25 0,35

0,45 0,55 0,65

0,75 0,85 0,95

Fraction of time a player is in lead

Pro

b. o

f b

ein

g in

lead

a g

iven

fr

acti

on

of

tim

e

•Hot hand in basquetball•Highly succesfull wall street trader•Random numbers test.

Methods for RoulleteShannon’s coin game

17

Example

• New R.V. Y: Daniel is in lead more than a given fraction of time.– Meaning: Y=X>f

)arcsin(21)1(

1)()(

:

1

fdxxx

fXPYP

YXY

f ππ−≈

−=>=

→→Ωℜ→Ω

)1(1

)(xx

XP−

ℜ→Ω:X

H H H H H H H H

F H H H HHHH

H F F H F F H H

F F F F F F F F

L

L

M

L

M

L

=Ω 0 1 X(.)X(.)

X0 1 P(X)P(X)

X

dxxx

fXPf∫ −

=>1

)1(1)(

π

18

0

0,02

0,04

0,06

0,08

0,1

0,12

0,14

0,16

0,05

0,15

0,25

0,35

0,45

0,55

0,65

0,75 0,85

0,95

Fraction of time a player is in lead

Pro

b. o

f be

ing

in le

ad a

giv

en

frac

tion

of t

ime

Example

• New R.V. Y: Daniel is in lead more than a given fraction of time.– Meaning: Y=X>f

)1(1

)(xx

XP−

ℜ→Ω:X

H H H H H H H H

F H H H HHHH

H F F H F F H H

F F F F F F F F

L

L

M

L

M

L

=Ω 0 1 X(.)X(.)

X0 1 P(X)P(X)

X

dxxx

fXPf∫ −

=>1

)1(1)(

π

f(x)=1-2/pi*arcsin(sqrt(x))

00,10,2

0,30,40,50,60,7

0,80,9

0,05

0,15

0,25

0,35

0,45

0,55

0,65

0,75

0,85

0,95

% of the time a player is in lead

P(%

tim

e in

lea

d)

Page 4: What is a random Variable?

4

19

Example

• New Rand.Var. Y: Daniel is in lead more than a given fraction of time.– Meaning: Y=X>f

)arcsin(21)1(

1)()(

:

1

fdxxx

fXPYP

YXY

f ππ−≈

−=>=

→→Ωℜ→Ω

f(x)=1-2/pi*arcsin(sqrt(x))

00,10,20,30,40,50,60,70,80,9

0,05

0,15

0,25

0,35

0,45

0,55

0,65

0,75

0,85

0,95

% of the time a player is in lead

P(%

tim

e in

lead

)

20

Distribution of a Random Variable

• Definition:– The distribution function of a discretediscrete random

variable X is defined as:

– With

∑≤∀

==≤=xx

ii

xXPxXPxF

)()()(

m

n

xxxX

AAAX

L

L

,,

,,:

21

21

=

=Ωℜ→Ω

21

Example

• Distribution function of the Rand.Var.: Fraction of time Daniel is in lead

0

0,2

0,4

0,6

0,8

1

1,2

0,05

0,15

0,25

0,35

0,45

0,55

0,65

0,75

0,85

0,95

Fraction of time a player is in lead

Acc

um

late

d p

rob

abili

ty

∑∑≤∀≤∀ −

===≤=

ℜ→Ω

xx iixxi

iixx

xXPxXPxF

X

)1(1)()()(

:

π

00,02

0,04

0,060,08

0,1

0,12

0,140,16

0,05

0,15 0,25 0,35

0,45 0,55 0,65

0,75 0,85 0,95

Fraction of time a player is in lead

Pro

b. o

f b

ein

g in

lead

a g

iven

fr

acti

on

of

tim

e

22

Example• Distribution function of the Rand.Var. : sum

of the values when a die is thrown twice

0

0,020,040,06

0,080,1

0,120,14

0,160,18

2 3 4 5 6 7 8 9 1 0 1 1 12

Random Value

Pro

b. o

f th

e ra

nd

om

val

ue

Ω∈+=

ℜ→Ω

j)(i,for ),(

:

jijiX

X

Accumulated Probability

0

0,2

0,4

0,6

0,8

1

2 3 4 5 6 7 8 9 10 11 12

Value of the sum

Acc

um

ula

ted

pro

bab

ility

∑≤∀

==≤=xx

ii

xXPxXPxF

)()()(

23

Example

• Distribution function of a Bernouilli trial until the first success, with probability of success p.– Model of a Bernouilli trials:

• Flipping a coin until a head appears.• Trying to get a connection until the service is given.• Booking a place in an airplane.

– Probability of a success in n trials

ppnXP

Nn 1)1()( −−==

→Ω

24

Example

• Distribution function of a Bernouilli trial until the first success, with probability of success p.

nn

xn SeriesGeometric

n

xn

pp

pp

ppnXPxXPxF

)1(1)1(1

)1(1

)1()()()(

1

−−=−−−−=

=−===≤= ∑∑≤∀

≤∀

Note: Complementary of the event,=does appears in none of the n trials

Page 5: What is a random Variable?

5

25

Example

• Distribution function of a Bernouilli trial until the first success, with probability of success p.

• Coin p=1/2

n

xn

pnXPxXPxF )1(1)()()(

−−===≤= ∑≤∀

Accumulated probability

0

0,2

0,4

0,6

0,8

1

1,2

0 1 2 3 4 5 6 7 8 9 10 11 12

Number of Trial

F(x)

=P(X

<x)

26

Example

• Distribution function of a Bernouilli trial until the first success, with probability of success p.

• Roullette p=1/37

n

xn

pnXPxXPxF )1(1)()()(

−−===≤= ∑≤∀

Accumulated probability

0

0,1

0,2

0,3

0,4

0,5

0 2 4 6 8 10 12 14 16 18 20 22Number of Trial

F(x)

=P(X

<x)

27

Example: Propagation of a rumor

• In a village of n inhabitants, one person explains something to a second, who tells is to a third, etc.

• The first selects one in the n-1 remaining. From then on, all the others select between n-2 (i.e. excludes the previous, and the original)

a) Distribution of the number of times that a rumor is transmited until it reaches again the source

b) Distribution of the number of times that a rumor is transmited until someone get’s it twice. (Exercise)

Taken from C álculo de probabilidades I, R. Vélez & V. Hernández28

Example: Propagation of a rumor

• Distribution of the number of times that a rumor is transmited until it reaches again the source.

– A j (j>2) cannot select the previous or de original

– Note that A1 and A2 cannot select A0

L4

different3-n

3

different3-n

2

different2-n

1

rumor theGenerates

0 AAAAA →→→→

29

Example: Propagation of a rumor

• Distribution of the number of times that a rumor is transmited until it reaches again the origin.

• We define the random variable:– R: Number of times that the rumor is transmited

until it returns to A0

• Scheme of the solution:

)()1()( rRPrRPrRP >−−>==

30

Example: Propagation of a rumor

• We will compute first• Remember:

– A j (j>2) cannot select the previous or de original– Note that A1 and A2 cannot select A0

• A1 and A2 do not count. A1 still has to talk to someone

• Event R>r

2

23

)(−

−−

=>r

nn

rRP

)( rRP >

LLdifferent

2-n 1r

different3-n r

different3-n 4

different3-n 3

different3-n 2

different2-n 1

rumor the Generates 0 AAAAAAA →→→→→→→ +

sequenceother Any AA,A,A 0r43 ANDrR ≠=> L

Page 6: What is a random Variable?

6

31

Example: Propagation of a rumor

• Distribution function of R)(1)()( rRPrRPrF >−=≤=

−−

<=

3r if 23-1

3r if 0)(

2r

nnrF

In a department with n=100

P( R<=r )

0

0,050,1

0,15

0,2

0,25

0,3

0,350,4

0,45

1 4 7

10

13

16

19

22

25

28

31

34

37

40

43

46

49

Repetitions of the rumor

Pro

b. o

f re

turn

ing

to

th

e o

rig

in

32

Example: Propagation of a rumor

• Probability of a given r

21

23

23

- 23

)(323

−−

=

−−

−−

==−−−

nnn

nn

nn

rRPrrr

)()1()( rRPrRPrRP >−−>==

In a department with n=100

P(R=r)

0

0,002

0,004

0,006

0,008

0,01

0,012

1 4 7

10

13

16

19

22

25

28

31

34

37

40

43

46

49

Repetitions of the rumor

P(R

=r)

33

Example: Propagation of a rumor

• With n=20

• Note that there is the possibility of loops

P( R<=r )

00,10,20,3

0,40,50,6

0,70,80,9

1

1 4 7

10

13

16

19

22

25

28

31

34

37

40

43

46

49

Repetitions of the rumor

Pro

b. o

f re

turn

ing

to t

he o

rigi

n

P(R=r)

0

0,01

0,02

0,03

0,04

0,05

0,06

0,07

1 4 7 10 13 16 19 22 25 28 31 34 37 40 43 46 49

Repetitions of the rumor

P(R

=r)