probability theory random variables

22
lecture 2 1 Probability theory Random variables Definition: A random variable X is a function defined on S, which takes values on the real axis an experiment a number is often attached to each ou X: S R Real numbers Sample space R S X(s) s

Upload: thi

Post on 31-Jan-2016

97 views

Category:

Documents


0 download

DESCRIPTION

Probability theory Random variables. In an experiment a number is often attached to each outcome. S. s. X(s). R. Definition: A random variable X is a function defined on S, which takes values on the real axis. X: S  R. Sample space. Real numbers. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Probability theory Random variables

lecture 21

Probability theoryRandom variables

Definition: A random variable X is a function defined on S, which takes values on the real axis

In an experiment a number is often attached to each outcome.

X: S R

Real numbersSample space

R

S

X(s)s

Page 2: Probability theory Random variables

lecture 22

Probability theoryRandom variables

Example:

Random variable Type

Number of eyes when rolling a dice discreteThe sum of eyes when rolling two dice discreteNumber of children in a family discreteAge of first-time mother discreteTime of running 5 km continuousAmount of sugar in a coke continuous Height of males continuous

counting

measure

Discrete: can take a finite number of values or an infinite but countable number of values.

Continuous: takes values from the set of real numbers.

Page 3: Probability theory Random variables

lecture 23

Discrete random variableProbability function

Definition: Let X : S R be a discrete random variable.

The function f(x) is a probabilty function for X, if

1. f(x) 0 for all x 2.

3. P(X = x) = f(x),

where P(X=x) is the probability for the outcomes sS : X(s) = x.

x

1)x(f

Page 4: Probability theory Random variables

lecture 24

Discrete random variableProbability function

Example: Flip three coins X : # heads X : S {0,1,2,3}

Probability fuinction

f(0) = P(X=0) = 1/8

f(1) = P(X=1) = 3/8

f(2) = P(X=2) = 3/8

f(3) = P(X=3) = 1/8

Value of X X=0 X=1 X=2 X=3

Outcome TTT

HTT, TTH, THTHHT, HTH, THHHHH

Notice! The definition of a probability function is fulfilled:

1. f(x) 02. f(x) = 13. P(X=x) = f(x)

Page 5: Probability theory Random variables

lecture 25

Discrete random variableCumulative distribution function

Definition:

Let X : S R be a discrete random variable with probability function f(x).

The cumulative distribution function for X, F(x), is defined by

F(x) = P(X x) = for - < x <

xt

)t(f

Page 6: Probability theory Random variables

lecture 26

Discrete random variableCumulative distribution function

Example: Flip three coins X : # heads X : S {0,1,2,3}

Cumulative dist. Func.

F(0) = P(X < 0) = 1/8F(1) = P(X < 1) = 4/8F(2) = P(X < 2) = 7/8F(3) = P(X < 3) = 1

Value of X

X=0 X=1 X=2 X=3

Outcome

TTTHTT, TTH, THTHHT, HTH, THHHHH

Probability function

f(0) = P(X=0) = 1/8f(1) = P(X=1) = 3/8f(2) = P(X=2) = 3/8f(3) = P(X=3) = 1/8

Cumulative distribution function:Probability function:

x0 1 2 3

0.10.20.30.4

x0 1 2 3

0.20.40.60.8

f(x) F(x) 1.0

Page 7: Probability theory Random variables

lecture 27

Continuous random variable

A continuous random variable X has probability 0 for all outcomes!!

Mathematically: P(X = x) = f(x) = 0 for all x

Hence, we cannot represent the probability function f(x) by a table or bar chart as in the case of discrtete random variabes.

Instead we use a continuous function – a density function.

Page 8: Probability theory Random variables

lecture 28

Definition: Let X: S R be a continuous random variables.

A probability density function f(x) for X is defined by:

1. f(x) 0 for all x

2.

3. P( a < X < b ) = f(x) dx

Note!! Continuity: P(a < X < b) = P(a < X < b) = P(a < X < b) = P(a < X < b)

Continuous random variableDensity function

b

a

1dx)x(f

Page 9: Probability theory Random variables

lecture 29

Probability of a service life longer than 3 years:

Example: X: service life of car battery in years (contiuous)

Density function:

Continuous random variableDensity function

0

0,1

0,2

0,3

0,4

0,5

1 3,5 63

otherwise

xforx

xforx

xf

0

65.316.096.0

5.3116.016.0

)(

68.0

)16.096.0()16.016.0(

)()3(

6

5.3

5.3

3

3

dxxdxx

dxxfXP

Page 10: Probability theory Random variables

lecture 210

Probability of a service life longer than 3 years:

Alternativ måde:

Continuous random variableDensity function

othwerwise

xforx

xforx

xf

0

65.316.096.0

5.3116.016.0

)(

0

0,1

0,2

0,3

0,4

0,5

1 3,5 63

68.032.01

)16.016.0(1

)(1

)3(1)3(

3

1

3

dxx

dxxf

XPXP

Page 11: Probability theory Random variables

lecture 211

Continuous random variableDensity function

Definition: Let X : S R be a contiguous random variable with density function f(x).

The cumulative distribution function for X, F(x), er defined by

F(x) = P(X x) = for - < x < Note: F´(x) = f(x)

32.0

dxx16.016.0

dx)x(f

)3X(P)3(F

3

1

3

0

0,1

0,2

0,3

0,4

0,5

1 3,5 63

x

dt)t(f

Page 12: Probability theory Random variables

lecture 212

Continuous random variableDensity function

0

0,1

0,2

0,3

0,4

0,5

1 3,5 6

From the definition of the cumulative distribution funct. we get:

P( a < X < b ) = P( a < X < b ) = P( a < X < b ) = P( a < X < b ) = P(X < b ) – P(X < a )

= F(b) – F(a)

a b

Page 13: Probability theory Random variables

lecture 213

Continuous random variableDensity function

Contiuous random variable • The sample space contains infinitely many outcomes

• Density function f(x) is a Continuous function

• Calculation of probabilities

P( a < X < b ) = f(t) dt

Discrete random variable

• Sample space is finite or has countable many outcomes

• Probability function f(x)Is often given by table

• Calculation of probabilitiesP( a < X < b) = f(t)

a<t<bb

a

Page 14: Probability theory Random variables

lecture 214

Joint distribution Joint probability function

Definition: Let X and Y be two discrete random variables. The joint probability function f(x,y) for X and YIs defined by

1. f(x,y) 0 for all x og y

2.

3. P(X = x ,Y = y) = f(x,y) (the probability that both X = x and Y=y)

For a set A in the xy plane:

x y

1)y,x(f

)y,x( A

)y,x(f)A)Y,X((P

Page 15: Probability theory Random variables

lecture 215

Joint distribution Marginal probability function

Definition: Let X and Y be two discrete random variables with joint probability function f(x,y).The marginal probability function for X is given by

g(x) = f(x,y) for all x

The marginal probability function for Y is given by

h(y) = f(x,y) for all y

y

x

Page 16: Probability theory Random variables

lecture 216

Joint distribution Marginal probability function

Example 3.14 (modified):The joint probability function f(x,y) for X and Y is given by

2

3/28

0

0

0

1

2

1

9/28

3/14

0

x 0

3/28

3/14

1/28

y• h(1) = P(Y =1) = 3/14+3/14+0 = 3/7

• g(2) = P(X= 2) = 3/28+0+0 = 3/28

• P(X+Y < 2) = 3/28+9/28+3/14 = 18/28 = 9/14

Page 17: Probability theory Random variables

lecture 217

Joint distributionJoint density function

Definition: Let X og Y be two continuous random variables. The joint density function f(x,y) for X and Y is defined by

1. f(x,y) 0 for all x

2.

3. P(a < X< b, c<Y< d) =

For a region A in the xy-plane: P[(X,Y)A] = f(x,y) dxdyA

1dydx)y,x(f

d

c

b

adydx)y,x(f

Page 18: Probability theory Random variables

lecture 218

Definition: Let X and Y be two continuous random variables with joint density function f(x,y).The marginal density function for X is given by

The marginal density function for Y is given by

Joint distributionMarginal density function

xallfordyyxfxg

),()(

yallfordxyxfyh

),()(

Page 19: Probability theory Random variables

lecture 219

Joint distributionMarginal density function

Example 3.15 + 3.17 (modified):Joint density f(x,y) for X and Y:

Marginal density function for X:

otherwise0

1y01,x03y)(2x5

2y)f(x,

53

x541

051

52

52

2

1

0

y3xy2

dy)y3x2(

dy)y,x(f)x(g

0

0.5

1

00.2

0.40.6

0.810

0.5

1

1.5

2

Page 20: Probability theory Random variables

lecture 220

Joint distributionConditional density and probability functions

Definition: Let X and Y be random variables (continuous or discrete) with joint density/probability function f(x,y). Then the

Conditional denisty/probability function for Y given X=x is

f(y|x) = f(x,y) / g(x) g(x) 0

where g(x) is the marginal density/probability function for X, and

the conditional density/probability function for X given Y=y is f(x|

y) = f(x,y) / h(y) h(y) 0

where h(y) is the marginal density/probability function for Y.

Page 21: Probability theory Random variables

lecture 221

Joint distributionConditional probability function

Examples 3.16 + 3.18 (modified):Joint probability functionf(x,y) for X and Y is given by:

2

3/28

0

0

0

1

2

1

9/28

3/14

0

x0

3/28

3/14

1/28

y

• marginal pf.

• P(Y=1 | X=1 ) = f(1|1) = f(1,1) / g(1) = (3/14) / (15/28) = 6/15

2xfor

1xfor

0xfor

)x(g

28328152810

Page 22: Probability theory Random variables

lecture 222

Joint distributionIndependence

Definition: Two random variables X and Y (continuous or discrete) with joint density/probability functions f(x,y) and marginal density/probability functions g(x) and h(y), respectively, are said to be independent if and only if

f(x,y) = g(x) h(y) for all x,y

or if f(x|y) = g(x) (x indep. of y) or f(y|x)=h(y) (y indep. af x)