President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3...

33
President University Erwin Sitompul PBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics http://zitompul.wordpress.com

Transcript of President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3...

Page 1: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/1

Dr.-Ing. Erwin SitompulPresident University

Lecture 3

Probability and Statistics

http://zitompul.wordpress.com

Page 2: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/2

Chapter 3

Random Variables and Probability Distributions

Chapter 3 Random Variables and Probability Distributions

Page 3: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/3

Concept of a Random Variable Random variable is a function that associates a real number with

each element in the sample space.

In other words, random variable is a numerical description of the outcome of an experiment, where each outcome gets assigned a numerical value.

Chapter 3.1 Concept of a Random Variable

A capital letter, say X, is used to denotes a random variable and its corresponding small letter, x in this case, for one of its values.

Page 4: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/4

Concept of a Random VariableChapter 3.1 Concept of a Random Variable

Two balls are drawn in succession without replacement from an urn containing 4 red balls and 3 black balls. The possible outcomes and the values y of the random variable Y, where Y is the number of red balls are

, , , , , , ,S DDD DDN DND DNN NDD NDN NND NNN

The sample space giving a detailed description of each possible outcome when three electronic components are tested may be written as

One is concerned with the number of defectives that occurs. Thus each point in the sample space will be assigned a numerical value of 0, 1, 2, or 3.

Then, the random variable X assumes the value 2 for all elements in the subset

, ,E DDN DND NDD

Page 5: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/5

Sample Space and Random Variable If a sample space contains a finite number of possibilities or an

unending sequence with as many elements as there are whole numbers, it is called a discrete sample space.

If a sample space contains an infinite number of possibilities equal to the number of points on a line segment, it is called a continuous sample space.

Chapter 3.1 Concept of a Random Variable

A random variable is called a discrete random variable if its set of possible outcomes is countable.

A random variable is called a continuous random variable if it can take on values on a continuous scale.

If X is the random variable assigned to the waiting time, in minute, for a bus at a bus stop, then the random variable X may take on all values of waiting time x, x ≥ 0.

In this case, X is a continuous random variable.

Page 6: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/6

Discrete Probability Distributions Frequently, it is convenient to represent all the probabilities of a

random variable X by a formula. Such a formula would necessarily be a function of the numerical

values x, denoted by f(x), g(x), r(x), and so forth. For example,

Chapter 3.2 Discrete Probability Distributions

( ) ( )f x P X x

The set of ordered pairs (x, f(x)) is a probability function, probability mass function, or probability distribution of the discrete random variable X if, for each possible outcome x,

1.

2.

3.

( ) 0f x

( ) 1x

f x ( ) ( )P X x f x

Page 7: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/7

Discrete Probability DistributionsChapter 3.2 Discrete Probability Distributions

In the experiment of tossing a fair coin twice, the random variable X represents how many times the head turns up. The possible value for x of X and their probability can be summarized as

Page 8: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/8

Discrete Probability DistributionsChapter 3.2 Discrete Probability Distributions

A shipment of 20 similar laptop computers to a retail outlet contains 3 that are defective. If a school makes a random purchase of 2 of these computers, find the probability distribution for the number of defectives.

Let X be a random variable, whose value x are the possible numbers of defective computers purchased by the school.

(0) ( 0)f P X

(1) ( 1)f P X

(2) ( 2)f P X

3 1 17 1

20 2

51

190

C C

C

3 2 17 0

20 2

3

190

C C

C

3 0 17 2

20 2

136

190

C C

C

Page 9: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/9

Discrete Probability Distributions There are many problems where we may wish to compute the

probability that the observed value of a random variable X will be less than or equal to some real number x.

The cumulative distribution F(x) of a discrete random variable X with probability distribution f(x) is

Chapter 3.2 Discrete Probability Distributions

( ) ( ) ( )t x

F x P X x f t

for x

Example of a probability distribution

Example of a cumulative distribution

Page 10: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/10

Continuous Probability Distributions In case the sample space is continuous, there can be unlimited

number of possible value for the samples. Thus, it is more meaningful to deal with an interval rather than a

point value of a random variable. For example, it does not make sense to know the probability of

selecting person at random who is exactly 164 cm tall. It will be more useful to talk about the probability of selecting a person who is at least 163 cm but not more than 165 cm.

Chapter 3.3 Continuous Probability Distributions

We shall concern ourselves now with computing probabilities for various intervals of continuous random variables such as P(a < X < b), P(W ≥ c), P(U ≤ d) and so forth.

Note that when X is continuous

( ) 0P X a

( ) ( ) ( ) ( )P a X b P a X b P X b P a X b

Probability of a point value is zero

Page 11: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/11

Continuous Probability Distributions In dealing with continuous variables, the notation commonly used

is f(x) and it is usually called the probability density function, or the density function of X.

For most practical application, the density functions are continuous and differentiable.

Their graphs may take any forms, but since it will be used to represent probabilities, the density function must lie entirely above the x axis to represent positive probability.

Chapter 3.3 Continuous Probability Distributions

x

f(x)

x

f(x)

x

f(x)

Page 12: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/12

Continuous Probability Distributions A probability density function is constructed so that the area under

its curve bounded by the x axis is equal to 1 when computed over the range of X for which f(x) is defined.

In the figure below, the probability that X assumes a value between a and b is equal to the shaded area under the density function between the ordinates at x = a and x = b.

Chapter 3.3 Continuous Probability Distributions

( ) ( )b

a

P a X b f x dx

Page 13: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/13

Continuous Probability Distributions The function f(x) is a probability density function for the

continuous random variable X, defined over the set of real numbers R if

1.

2.

3.

Chapter 3.3 Continuous Probability Distributions

( ) ( )b

a

P a X b f x dx

( ) 1f x dx

( ) 0, for allf x x R

Page 14: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/14

Continuous Probability DistributionsChapter 3.3 Continuous Probability Distributions

Suppose that the error in the reaction temperature, in °C, for a controlled laboratory experiment is a continuous random variable X having the probability density function

2

, 1 2( ) 30, elsewhere

xxf x

(a) Verify whether

(b) Find P(0 < X ≤ 1)

( ) 1f x dx

(a) 2 2

1

( )3

xf x dx dx

23

19

x

8 1

9 9

1

(b) 1 2

0

(0 1)3

xP X dx

13

09

x

1

9

Page 15: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/15

Continuous Probability DistributionsChapter 3.3 Continuous Probability Distributions

The cumulative distribution F(x) of a continuous random variable X with density function f(x) is

( ) ( ) ( ) , forx

F x P X x f t dt x

For the density function in the last example, find F(x) and use it to evaluate P(0 < X ≤ 1).

( ) ( )x

F x f t dt

2

1 3

x tdt

3

19

xt

3 1

, 1 29

forx

x

(0 1) (1) (0)P X F F 2 1

9 9

3

0, 11

( ) , 1 29

1, 2

xx

F x x

x

1

9

Page 16: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/16

Joint Probability DistributionsChapter 3.4 Joint Probability Distributions

If X and Y are two discrete random variables, the probability distribution for their simultaneous occurrence can be represented by a function with values f(x, y) for any pair of values (x, y) within the range of the random variables X and Y.

Such function is referred to as the joint probability distribution of X and Y.

The function f(x, y) is a joint probability density function or joint probability distribution function of the discrete random variables X and Y if1.

2.

3.

For any region A in the xy plane,

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

( , ) 1x y

f x y (( , ) 0, , )for allf x y x y R

( , ) ( , )A

P X Y A f x y

Page 17: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/17

Joint Probability DistributionsChapter 3.4 Joint Probability Distributions

Two ballpoint pens are selected at random from a box that contains 3 blue pens, 2 red pens, and 3 green pens. If X is the number of blue pens selected and Y is the number of red pens selected, find (a) the joint probability function f(x, y)(b) P[(X, Y) A], where A is the region {(x, y)|x + y ≤ 1}

(a) 3 2 3 2

8 2

( , ) ,

0,1,2; 0,1,2; 0 2for

x y x yC C Cf x y

Cx y x y

(b) ( , ) ( 1)P X Y A P X Y

(0,0) (0,1) (1,0)f f f 3 3 9

28 14 28

9

14

Page 18: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/18

Joint Probability DistributionsChapter 3.4 Joint Probability Distributions

The function f(x, y) is a joint probability density function of the continuous random variables X and Y if

1.

2.

3.

For any region A in the xy plane.

( , ) 1f x y dxdy

(( , ) 0, , )for allf x y x y R

( , ) ( , )A

P X Y A f x y dxdy

Page 19: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/19

Joint Probability DistributionsChapter 3.4 Joint Probability Distributions

A privately owned business operates both a drive-in facility and a walk-in facility. On a randomly selected day, let X and Y, respectively, be the proportions of the time that the drive-in and the walk-in facilities are in use, and suppose that the joint density function of these random variables is

(a) Verify that f(x, y) is a joint density function.(b) Find P[(X, Y) A], where A is {(x, y)|0 < x < 1/2, 1/4 < y < 1/2}.

(a)

25 (2 3 ), 0 1, 0 1

( , )0, elsewhere

x y x yf x y

1 1

0 0

2( , ) (2 3 )

5y x

f x y dxdy x y dxdy

11

2

0 0

2 6

5 5

x

x

x yx dy

1

0

2 6

5 5y dy

12

0

2 6

5 10y y

2 61

5 10

Page 20: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/20

Joint Probability DistributionsChapter 3.4 Joint Probability Distributions

(b) Find P[(X, Y) A], where A is {(x, y)|0 < x < 1/2, 1/4 < y < 1/2}.

1 21 22

1 4 0

2 6

5 5

x

x

x yx dy

1 2

1 4

1 3

10 5y dy

1 22

1 4

1 3

10 10y y

1 1 1 3 1 1

10 2 4 10 4 16

1 1 12 4 2( , ) (0 , )P X Y A P X Y

1 2 1 2

1 4 0

2(2 3 )5y x

x y dxdy

13

160

Page 21: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/21

Marginal Probability DistributionsChapter 3.4 Joint Probability Distributions

The marginal probability distribution functions of X alone and of Y alone are

( ) ( , ) ( ) ( , )andy x

g x f x y h y f x y for the discrete case, and

( ) ( , ) ( ) ( , )andg x f x y dy h y f x y dx

for the continuous case.

The term marginal is used here because, in discrete case, the values of g(x) and h(y) are just the marginal totals of the respective columns and rows when the values of f(x, y) are displayed in a rectangular table.

Page 22: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/22

Marginal Probability DistributionsChapter 3.4 Joint Probability Distributions

Show that the column and row totals from the “ballpoint pens” example give the marginal distribution of X alone and of Y alone.

2

0

(0) (0, )y

g f y

3 3 1 5

28 14 28 14

(0,0) (0,1) (0,2)f f f

2

0

(1) (1, )y

g f y

9 3 15

028 14 28

(1,0) (1,1) (1,2)f f f

2

0

(2) (2, )y

g f y

3 3

0 028 28

(2,0) (2,1) (2,2)f f f It is found that the values of

g(x) are just the column totals of the table above.

In similar manner we could show that the values of h(y) are given by the row totals.

Page 23: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/23

Marginal Probability DistributionsChapter 3.4 Joint Probability Distributions

Find f(x) and h(y) for the joint density function of the “drive-in walk-in facility” example. 2

5 (2 3 ), 0 1, 0 1( )

0, elsewhere

x y x yf x

( ) ( , )g x f x y dy

1

0

2(2 3 )5

x y dy 1

2

0

4 6

5 10xy y

4 3

5 5x

( ) ( , )h y f x y dx

1

0

2(2 3 )5

x y dx 1

2

0

2 6

5 5x yx

2 6

5 5y

Page 24: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/24

Conditional Probability DistributionsChapter 3.4 Joint Probability Distributions

Let X and Y be two random variables, discrete or continuous. The conditional probability distribution function of the random variable Y, given than X = x, is

( , )( ) , ( ) 0

( )

f x yf y x g x

g x

Similarly, the conditional distribution of the random variable X, given that Y = y, is

( , )( ) , ( ) 0

( )

f x yf x y h y

h y

Page 25: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/25

Conditional Probability DistributionsChapter 3.4 Joint Probability Distributions

If one wished to find the probability that the discrete random variable X falls between a and b when it is known that the discrete variable Y = y, we evaluate

( ) ( )x

P a X b Y y f x y where the summation extends over all available values of X between a and b.

( ) ( )b

a

P a X b Y y f x y dx

When X and Y are continuous, we can find the probability that X lies between a and b by evaluating

Page 26: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/26

Conditional Probability DistributionsChapter 3.4 Joint Probability Distributions

Referring back to the “ballpoint pens” example, find the conditional distribution of X, given that Y = 1, and use it to determine P(X = 0 | Y = 1).

( , )( )

( )

f x yf x y

h y

( ,1)( 1) , 0,1,2

(1)

f xf x x

h

(0,1)(0 1)

(1)

ff

h

(1,1)(11)

(1)

ff

h

(2,1)(2 1)

(1)

ff

h

3 14

3 7

3 14

3 7

0

3 7

1

2

1

2

0 1

0 1 0 12

P X Y f

Page 27: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/27

Conditional Probability DistributionsChapter 3.4 Joint Probability Distributions

Given the joint density function2(1 3 ), 0 2, 0 1( , ) 4

0, elsewhere

x yx yf x y

find g(x), h(y), f(x|y), and evaluate P(1/4 < X < 1/2|Y = 1/3).

( ) ( , )g x f x y dy

1 2

0

(1 3 )

4

x ydy

13

0

( )

4

x y y

, 0 22

xx

( ) ( , )h y f x y dx

2 2

0

(1 3 )

4

x ydx

22 2

0

(1 3 )

8

x y

21 3, 0 1

2

yy

( , )( )

( )

f x yf x y

h y

2

2

(1 3 ) 4

(1 3 ) 2

x y

y

, 0 2, 0 12

xx y

1 2

1 4

(1 4 1 2 1 3) ( )P X Y f x y dx 1 2

1 4 2

xdx

1 22

1 44

x

3

64

Page 28: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/28

Statistical IndependenceChapter 3.4 Joint Probability Distributions

Let X and Y be two random variables, discrete or continuous, with joint probability distribution f(x, y) and marginal distributions g(x) and h(y), respectively. The random variables X and Y are said to be statistically independent if and only if

( , ) ( ) ( )f x y g x h y

for all (x, y) within their range.

Page 29: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/29

(a)

Statistical IndependenceChapter 3.4 Joint Probability Distributions

Consider the following joint probability density function of random variables X and Y.

3, 1 4,1 2( , ) 18

0, elsewhere

x yx yf x y

(a) Find the marginal density functions of X and Y(b) Are X and Y statistically independent?(c) Find P(X > 2|Y = 2)

( ) ( , )g x f x y dy

2

1

3

18

x ydy

22

1

6

36

xy y

6 3 2 1, 1 4

36 12

x xx

( ) ( , )h y f x y dx

4

1

3

18

x ydx

42

1

3 2

36

x yx

45 6 15 2, 1 2

36 12

y yy

Page 30: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/30

Statistical IndependenceChapter 3.4 Joint Probability Distributions

2 1 15 2 3( ) ( ) ( , )

12 12 18

x y x yg x h y f x y

(b) Are X and Y statistically independent?

X and Y are not statistically independent

(c) Find P(X > 2|Y = 2)4

22

( 2 2) ( )y

P X Y f x y dx

4

2 2

( , )

( )y

f x ydx

h y

4

2

(3 2) 18

(15 4) 12

xdx

4

2

2(3 2)

33x dx

4

2

2

2 32

33 2x x

28

33

4

2

( , 2)

(2)

f xdx

h

Page 31: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/31

Statistical IndependenceChapter 3.4 Joint Probability Distributions

Let X1, X2, ..., Xn be n random variables, discrete or continuous, with joint probability distribution f(x1, x2, ..., xn) and marginal distributions f1(x1), f2(x2), ..., fn(xn), respectively. The random variables X1, X2, ..., Xn are said to be mutually statistically independent if and only if

1 2 1 1 2 2( , ,..., , ) ( ) ( ) ( )n n nf x x x f x f x f x

for all (x1, x2, ..., xn)) within their range.

Page 32: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/32

Statistical IndependenceChapter 3.4 Joint Probability Distributions

Suppose that the shelf life, in years, of a certain perishable food product packaged in cardboard containers is a random variable whose probability density function is given by

, 0( )0, elsewhere

xe xf x

Let X1, X2, and X3 represent the shelf lives for three of these containers selected independently and find P(X1<2, 1<X2<3, X3>2)

1 2 3 1 2 3( , , ) ( ) ( ) ( )f x x x f x f x f x 31 2 xx xe e e

31 2

3 2

1 2 3 1 2 3

2 1 0

( 2,1 3, 2) xx xP X X X e e e dx dx dx

31 2

2 3

0 1 2

xx xe e e

2 1 3 2(1 )( )( )e e e e

0.0372

Page 33: President UniversityErwin SitompulPBST 3/1 Dr.-Ing. Erwin Sitompul President University Lecture 3 Probability and Statistics .

President University Erwin Sitompul PBST 3/33

Homework 3Probability and Statistics

2. Let the random variable X denote the time until a computer server connects to your notebook (in milliseconds), and let Y denote the time until the server authorizes you as a valid user (in milliseconds). Each of these random variables measures the wait from a common starting time. Assume that the joint probability density function for X and Y is

(a) Show that X and Y are independent.

(Mo.E5.20)

(b) Determine P(X > 1000, Y < 1000).

6 0.001 0.0022 10 , 0, 0( , )0, elsewhere

x ye x yf x y

1. A game is played with the rule that a counter will move forward one, two, or four places according to whether the scores on the two dice rolled differ by three or more, by one or two, or are equal.Here we define a random variable, M, the number of places moved, which can take the value 1, 2, or 4. Determine the probability distribution of M.

(Sou.04.E1 s.2)