The random variable -...

41
1 The The random random variable variable

Transcript of The random variable -...

Page 1: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

1

The The randomrandom variablevariable

Page 2: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

2

ContentsContents

1. Definition2. Distribution and density function3. Specific random variables4. Functions of one random variable5. Mean and variance

Page 3: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

3

The random variableThe random variable

A random variable (RV) represents a process of assigning to

every outcome of an experiment Ω a number ( )= ωx X

Page 4: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

4

The random variableThe random variable

such that

Thus a RV is a function with domain the set of experimental

outcomes and range a set of numbers

All RV will be written in capital letters.

Ω→X :

∀ ∈ = ω ω ≤ ∈Αrx , A : X( ) x

Page 5: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

5

Events generated by RVsEvents generated by RVs

For a given random variable, we are able to answer the following question:

What is the probability that the RV X is less than a given number?

That is, what is the probability of all outcomes such that:

What is the probability that the RV X is between the numbers x1 and x2?

That is, what is the probability of all outcomes such that:( )( )ω < ω ≤1 2P : x X x ?

( )( )ω ω ≤P : X x ?

( )≤P X x ?

ω

( )< ≤1 2P x X x ?

ω

Page 6: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

6

Example:the sum of the outcomes in a two dice roll experiment

( )( )ω ω =P : X x

X=2 (1,1) 1/36 X=3 (1,2);(2,1) 2/36 X=4 (1,3);(2,2);(3,1) 3/36 X=5 (1,4);(2,3);(3,2);(4,1) 4/36 X=6 (1,5);(2,4);(3,3);(4,2);(5,1) 5/36 X=7 (1,6);(2,5);(3,4);(4,3);(5,2);(6,1) 6/36 X=8 (2,6);(3,5);(4,4);(5,3);(6,2) 5/36 X=9 (3,6);(4,5);(5,4);(6,3) 4/36 X=10 (4,6);(5,5);(6,4) 3/36 X=11 (5,6);(6,5) 2/36 X=12 (6,6) 1/36

( )= ωx X ω

Page 7: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

7

The distribution functionThe distribution function

Given a number x, we can form the event

This event depends on x; hence its probability is a function of x.

This function is called cumulative distribution function.

( ) ω ω ≤: X x

( ) ( ) ( )( )= ≤ = ω ω ≤ ∀ ∈XF x P X x P : X x x

Page 8: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

8

Properties of distributionsProperties of distributions

1.The function , is monotonically increasing; that is,

if then

2.

3.

4.

<1 2x x

( )XF x

( ) ( )≤X 1 X 2F x F x

( ) → → +∞XF x 1 x ( ) → → −∞XF x 0 x

( ) ( ) ( )< ≤ = − ∀ ∈ <1 2 X 2 X 1 1 2 1 2P x X x F x F x x ,x , x x

( ) ( )> = − XP X x 1 F x

Page 9: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

9

Properties of distributionsProperties of distributions

5. The function might be continuous or discontinuous .

If the experiment consists of finitely many outcomes,

is a staircase function.

This is also true if consists of infinitely many

outcomes but X takes finitely many values.

Ω

Ω

( )XF x

Page 10: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

10

Properties of distributionsProperties of distributions

Let’s consider a discontinuous function, for example that of the sum of two dice roll:

0

0,2

0,4

0,6

0,8

1

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

Page 11: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

11

Properties of distributionsProperties of distributions

Let’s examine its behavior at a discontinuous point, e.g. at the value x0 = 3.We have:

0

0,2

0,4

0,6

0,8

1

1,2

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

( ) ( )−→

= < =Xx 3

1lim F x P X 336

( ) ( )→

= ≤ =Xx 3

3limF x P X 336

( ) ( )+→

= ≤ =Xx 3

3lim F x P X 336

( ) ( ) ( ) ( )+ −→ →

− = ≤ − < = = =X Xx 3 x 3

2lim F x lim F x P X 3 P X 3 P(x 3)36

This is true in general.

Page 12: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

12

Continuous and Discrete RVsContinuous and Discrete RVs

We shall say that a RV X is of continuous type if its

distribution is continuous for every x.

In this case

Hence,

( ) ( ) ( )− +→ →

= =0 0

X X 0 Xx x x xlim F x F x lim F x

( )= =0P X x 0

( ) ( ) ( )≤ = < = XP X x P X x F x

( ) ( ) ( ) ( )< ≤ = < < = −1 2 1 2 X 2 X 1P x X x P x X x F x F x

Page 13: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

13

Continuous and Discrete RVsContinuous and Discrete RVs

We shall say that a RV X is of discrete type if its

distribution is a staircase function.

Page 14: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

14

The density function of continuous RVsThe density function of continuous RVs

We can use the distribution function to determine the

probability that the RV X takes values in an arbitrary region R

of the real axis.

This result can be expressed in terms of the derivative

f(x) of F(x), assuming that the derivative of F(x) exists nearly

everywhere.

Page 15: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

15

The density function of continuous RVsThe density function of continuous RVs

The derivative of the distribution function is called

probability density function

( ) ( ) ( ) ( ) ( )∆ → ∆ →

+ ∆ − < ≤ + ∆′= = =

∆ ∆X X

X X x 0 x 0

F x x F x P x X x xf x F x lim lim

x x

Page 16: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

16

Properties of density functionProperties of density function

1. Since F increases as x increases, we conclude that

2. Integrating the density function from x1 to x2 we obtain

Thus the area of fX(x) in an interval (x1,x2) equals the

probability that X is in this interval.

( ) ≥Xf x 0

( ) ( ) ( ) ( )= − = < <∫2

1

x

X X 2 X 1 1 2x

f x dx F x F x P x X x

Page 17: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

17

Properties of density functionProperties of density function

3.

4. Finally, which is referred to as the

normalization condition.

( ) ( )∞

= ∫x

X XF x f x dx

( )+∞

−∞

=∫ Xf x dx 1

Page 18: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

18

The probability function of a discrete RVsThe probability function of a discrete RVs

Suppose now that F is a staircase function with discontinuities at the points xi.

In this case, the RV takes the values xi with probability:

The numbers pi will be represented graphically by vertical segments at the points xi with height equal to pi.

( ) ( ) ( )−= = = −i i X i X iP X x p F x F x

Page 19: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

19

The probability function of a discrete RVsThe probability function of a discrete RVs

Occasionally, we shall use the notation

The function fX so defined will be called point density.

Note that its values are not the derivatives of FX, but they equal the discontinuity jumps of FX.

( )=i X ip f x

Page 20: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

20

SpecificSpecific randomrandom variablesvariables

Page 21: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

21

We introduce various RVs with specified distribution.

To do so it is not necessary to specify the underlying experiment.

Given a distribution F, we can construct an experiment and a RV X such that its distribution equals F.

In the study of a RV we can avoid the notion of an abstract space.

We can assume that the underlining experiment is the real line and its outcomes the value x of X.

Page 22: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

22

Discrete Discrete randomrandom variablesvariables

Page 23: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

23

The The bernoullibernoulli RVRV

We shall say that a RV X has a Bernoulli distributionif it assumes the following two values with the corresponding probability

⎧= ⎨ −⎩

0 1X

1 p p

0 1 x

fX

1-pp

Page 24: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

24

The Bernoulli RVThe Bernoulli RV

The corresponding distribution is

( )<⎧

⎪= − ≤ <⎨⎪ ≥⎩

X

0 X 0F x 1 p 0 X 1

1 X 1

FX

11-p

0 1 x

Page 25: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

25

The binomial RVThe binomial RV

We shall say that a RV X has a Binomial distribution of order n if takes the values 0,1,…n with probabilities

( ) −⎛ ⎞= = = + =⎜ ⎟

⎝ ⎠k n kn

P X k p q k 0,1,...,n; p q 1k

The Binomial distribution originates in the experiment of independently repeated trials, if we define X as the number ofsuccesses of an event A (P(A)=p) in n trials.

Assume we toss n times a fair coin. A is the event ‘head’, whose probability is p=0.5.X is the number of heads in the n repetitions .

Page 26: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

26

Continuous random variablesContinuous random variables

Page 27: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

27

The Uniform RVThe Uniform RV

We shall say that a RV X is uniform or uniformly distributed in the interval (a,b) if

( )⎧ ≤ ≤⎪= −⎨⎪⎩

X

1 a X bf x b a

0 elsewhere

a b

1b a−

x

fX

Page 28: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

28

The Uniform RVThe Uniform RV

The corresponding distribution is a ramp

( )

<⎧⎪⎪ −= ≤ ≤⎨

−⎪⎪ >⎩

X

0 X ax aF x a X bb a1 X b

a b

1

x

FX

Page 29: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

29

The Exponential RVThe Exponential RV

We shall say that a RV X has an exponential distribution if

( ) −

<⎧= ⎨

> >⎩X cx

0 x 0f x

ce x 0,c 0

c

x

fX

Page 30: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

30

The Uniform RVThe Uniform RV

The corresponding distribution is

( ) −

<⎧= ⎨

− ≥ >⎩X cx

0 x 0F x

1 e x 0,c 0

1

x

FX

Page 31: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

31

The Normal RVThe Normal RV

We shall say that a RV X is standard normal or Gaussian if its density is the function

( )−

2x2

X1g x e2

x

1

gX

Page 32: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

32

The Normal RVThe Normal RV

The corresponding distribution is the function

( )ξ

−∞

= ξπ∫

2x2

X1G x e d2

x

1GX

From the evenness of g(x) it follows that ( ) ( )− = −X XG x 1 G x

Page 33: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

33

The Normal RVThe Normal RV

Shifting and scaling g(x), we obtain the general normal curves:

( )( )−µ

−σ − µ⎛ ⎞= = ⎜ ⎟σ σσ π ⎝ ⎠

2

2x2

X1 1 xf x e g2

σ

x

fX

µ

Page 34: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

34

The Normal RVThe Normal RV

We shall use the notation to indicate that the RV X is normal.

Thus indicates that X is standard normal.

If X is normal, , then [ ]µ σ∼X N ,

[ ]∼X N 0,1

[ ]µ σ∼X N ,

( ) ( ) ( ) − µ − µ⎛ ⎞ ⎛ ⎞< < = − = −⎜ ⎟ ⎜ ⎟σ σ⎝ ⎠ ⎝ ⎠2 1

1 2 X 2 X 1 X Xx xP x X x F x F x G G

Page 35: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

35

The Normal RVThe Normal RV

With

one has

This is the area of the normal curve in the interval .

The following special cases are of particular intrests:

( )µ − σ µ + σk , k

( ) ( ) ( ) ( )µ − σ < < µ + σ = − − = −X X XP k X k G k G k 2G k 1

= µ − σ = µ + σ1 2x k , x k

Page 36: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

36

The Normal RVThe Normal RV

The following special cases are of particular interests:

( )µ − σ < < µ + σP X 0.683

( )µ − σ < < µ + σP 2 X 2 0.954

( )µ − σ < < µ + σP 3 X 3 0.997

We note further that:

( )µ − σ < < µ + σ =P 1.96 X 1.96 0.95

( )µ − σ < < µ + σ =P 2.58 X 2.58 0.99

( )µ − σ < < µ + σ =P 3.29 X 3.29 0.999

Page 37: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

37

Functions of one random variableFunctions of one random variable

Page 38: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

38

Functions of one random variableFunctions of one random variable

Given a function g(x), of the real variable x and a RV X with domain the space Ω, we form the composite function

This function define a RV Y with domain the set Ω .

For a specific the value of the RV so formed is

given by , where .

( )ωiYω ∈Ωi

( ) ( )( )ω = ωY g X

( )=i iy g x

x

( )= ωi ix X

Page 39: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

39

Density of Density of g(Xg(X))

It is possible to determine the density fY of the RV Y=g(X) in terms of the density fY of the RV X.

To do so we form the equation

Where y is a specified number, and we solve for x.

( ) =g x y

x

Page 40: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

40

Density of Density of g(Xg(X))

The solutions of this equation are the abscissas xi of the intersections points of the horizontal line LY with the curve g(x)

y Ly

x1 x2 x3

Page 41: The random variable - geomatica.como.polimi.itgeomatica.como.polimi.it/corsi/statistical-analysis/2_RV.pdf · Functions of one random variable 5. ... i will be represented graphically

41

Density of Density of g(Xg(X))

Theorem:For a specific y, the density fY(y) is given by:

where xi are the roots of g(x)=y, and g’(xi) are the derivatives of g(x) at x=xi.

( ) ( )( )=

=′∑ i

Y ii

f x xf y

g x