Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A...

46
Ch 5 Probability: The Mathematics of Randomness

Transcript of Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A...

Page 1: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Ch 5 Probability: The Mathematics of Randomness

Page 2: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

5.1.1 Random Variables and Their Distributions

• A random variable is a quantity that (prior to observation) can be thought of as dependent on chance phenomena.

Toss a coin 10 times X=# of heads

Toss a coin until a head X=# of tosses needed

Page 3: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

More random variablesToss a die X=points showing

Plant 100 seeds of pumpkins X=% germinating

Test a light bulb X=lifetime of bulb

Test 20 light bulbs X=average lifetime of bulbs

Page 4: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Types of Random Variable

• A discrete random variable is one that has isolated or separated possible values.

(Counts, finite-possible values)

• A continuous random variable is one that can be idealized as having an entire (continuous) interval of numbers as its set of possible values.(Lifetimes, time, compression strength 0infinity)

Page 5: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Probability Distribution• To specify a probability distribution for a random variable is to

give its set of possible values and (in one way or another) consistently assign numbers between 0 and 1 –called probabilities– as measures of the likelihood that be various numerical values will occur.

• It is basically a rule of assigning probabilities to random events.

Roll a die, X=# showing

x 1 2 3 4 5 6 f(x) 1/6 1/6 1/6 1/6 1/6 1/6

Page 6: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Probability Distribution

The values of a probability distribution must be numbers on the interval from 0 to 1.

The sum of all the values of a probability distribution must be equal to 1.

Page 7: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Example

Inspect 3 parts. Let X be the # of parts with defect. Find the probability distribution of X.

First, what are possible values of X?

(0, 1,2,3)

Page 8: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

When does X take on each value?

Outcome X {NNN} 0 {NND, NDN, DNN} 1 {NDD, DND, DDN} 2 {DDD} 3 • If P(D)=0. 5, then P(N)=0.5 We have x 0 1 2 3f(x)=P(X=x) 1/8 3/8 3/8 1/8

Page 9: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Cumulative Distribution Function

• Cumulative distribution F(x) of a random variable X is

• Since (for discrete distributions) probabilities

are calculated by summing values of f(x), for a discrete distribution

( ) ( )z x

F x f z

( ) ( )F x P X x

Page 10: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

“Defect” Example continued

We had f(0)=1/8, f(1)=f(2)=3/8, f(3)=1/8.Therefore

• F(0)=f(0)=1/8;• F(1)=f(0)+f(1)=1/8+3/8=1/2;• F(2)=f(0)+f(1)+f(2)=7/8;• F(3)=f(0)+f(1)+f(2)+f(3)=1.

1,

7/8,

1/2,

1/8,

0,

F(x)

3.x

3;x2

2;x1

1;x0

0;x

Page 11: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Summaries of Discrete Probability Distributions

Given a set of numbers, for example, S= {1, 1, 1, 1, 3, 3, 4, 5, 5 , 6 }To calculate the average of these 10 numbers, you can use

Or you can get it this way

310

30

10

6554331111

3.

)10

1(6)()

10

2(5)()

10

1(4)()

10

2(3)()

10

4(1)(

10

(6)(1)(5)(2)(4)(1)(3)(2)(1)(4)

Page 12: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Mean or ExpectationThe above result is the weighted sum of x values:

x 1 3 4 5 6Weights 4/10 2/10 1/10 2/10 1/10

f(x) 0.4 0.2 0.1 0.2 0.1

The weights are actually the probability distribution for a random variable X .

The weighted sum, 3, is called the mean or mathematical expectation of random variable X.

Page 13: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Definition

Let X be a discrete random variable with probability distribution f(x). The mean or expected value of X is

The expectation or mean of a random variable X is the long run average of the observations from the random variable X.

The mean of X is not necessarily a possible value for X.

x

xf(x)E(X) μ

Page 14: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Back to “defect” example

• What is the average number of defective items we expect to see?X f(x)0 1/81 3/82 3/83 1/8

1 3 3 1 3( ) ( ) 0 1 2 3

8 8 8 8 2E X x f x

Page 15: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Variance

• The mean is a measure of the center of a random variable or distribution

X: x= -1 0 1 f(x) ¼ ½ ¼

Y: y= -2 0 2 g(y) ¼ ½ ¼ Both variables have the same center: 0

Which has a larger variability?

Page 16: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Variance

• Deviation from the center (mean) XX

The average of XX is zero!

• Consider the weighted average of (XX)2

E(X0)2=(1)(1/4)+(0)(1/2)+(1)(1/4)=1/2 E(Y0)2=(4)(1/4)+(0)(1/2)+(4)(1/4)=2

Y is more variable!

Page 17: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Definition• Let X be a discrete random variable with probability

distribution f(x) and mean

• The variance of X is

The positive square root of the 2 is called standard deviation of X, denoted by .

f(x)μ)(x ]μ)E[(X σ2

x

22

Page 18: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Back to “defect” example

X f(x)0 1/81 3/82 3/83 1/8

2 2 2

2 2 2 2

( ) ( ) ( ) ( )

1 3 3 1(0 1.5) (1 1.5) (2 1.5) (3 1.5)

8 8 8 8

Var X E x x f x

Page 19: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

2 2 2 2 2

2 2 2 2

2

1 3 3 1( ) 0 1 2 3 3

8 8 8 8

( ) ( ) 3 1.5 0.75

0.75

E X

Var X E X

Page 20: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Binomial Distribution

In many applied problems, we are interested in the probability that an event will occur x times out of n.

Page 21: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

For exampleInspect 3 items. X=# of defects. D=a defect, N=not a defect, Suppose P(N)=5/6

No defect: (x=0)NNN (5/6)(5/6)(5/6)

One defect: (x=1)NND (5/6)(5/6)(1/6) NDN same DNN same

Two defect: (x=2)NDD (5/6)(1/6)(1/6)DND sameDDN same

Three defect: (x=3)DDD (1/6)(1/6)(1/6)

Page 22: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Binomial distribution• x f(x) 0 (5/6)3

1 3(1/6)(5/6)2

2 3(1/6)2(5/6) 3 (1/6)3

xx

xxf

3

6

5

6

13)(

[P(D)]# of D

How many ways to choose x of 3 places for D.

__ __ __

[1-P(D)]3- # of D

Page 23: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

In general: n independent trials p probability of a success x=# of successes

ways to choose x places for sucesses,

( ) (1 )x n x

n

x

nf x p p

x

Page 24: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

• Roll a die 20 times. X=# of 6’s,n=20, p=1/6

• Flip a fair coin 10 times. X=# of heads

20

4 16

20 1 5( )

6 6

20 1 5( 4)

4 6 6

x x

f xx

p x

1010

2

110

2

1

2

110)(

xxxf

xx

Page 25: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

More example• Pumpkin seeds germinate with probability

0.93. Plant n=50 seeds• X= # of seeds germinating

xx

xxf

5007.093.0

50)(

248 07.093.048

50)48(

XP

Page 26: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Mean of Binomial Distribution

• X=# of defects in 3 items x f(x) 0 (5/6)3

1 3(1/6)(5/6)2

2 3(1/6)2(5/6) 3 (1/6)3

Expected long run average of X?

Page 27: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

The mean of a binomial distribution

• Binomial distribution n= # of trials,

p=probability of success on each trial X=# of successes

( ) (1 )x n xnE x x p p np

x

Page 28: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

• Let’s check this.

• Use binomial mean formula

33

0

3 2 2 3

3 1 5( ) ( )

6 6

5 1 5 1 5 10* 1*3 2*3 3* 1/ 2

6 6 6 6 6 6

x x

Xx

E X x f x xx

( ) 3*1/ 6 1/ 2E x np

Page 29: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

More examples

• Toss a die n=60 times, X=# of 6’sknown that p=1/6

μ=μX =E(X)=np=(60)(1/6)=10

We expect to get 10 6’s.

Page 30: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Variance for Binomial distribution

• σ2=np(1-p)

where n is # of trials and p is probability of a success.

• From the previous example, n=3, p=1/6

Then

σ2=np(1-p)=3*1/6*(1-1/6)=5/12

Page 31: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)
Page 32: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)
Page 33: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

• It is often useful to define a random variable that counts the number of “events” that occur within certain boundaries.

• # of defects in an item• # of radioactive particles emitted by a

substance• # of telephone calls received by an operator

within a certain time limit.

5.1.5 Poisson Distribution

Page 34: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

• A random variable X with a Poisson distribution takes the values x=0, 1, 2, 3,… with a probability distribution function

( ) ( ) , 0,1,2,...!

xef x P X x x

x

Page 35: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)
Page 36: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Exercise

• The number of monthly breakdowns of the kind of computer used by an office is a random variable having the Poisson distribution with λ=1.6. Find the probabilities that this kind of computer will function for a month– Without a breakdown;– With one breakdown;– With two breakdowns.

Page 37: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Glass Sheet Flaws Example

• A quality inspector at a glass manufacturing company inspects sheets of glass to check for any slight imperfections. Suppose that the number of these flaws in a glass sheet has a Poisson distribution with parameter λ=0.5. (This implies that the expected number of flaws per sheet is only 0.5.)

Page 38: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

1) What is the probability that there are no flaws in a sheet? (percentage of the glass sheets in “perfect condition”

So about 61% of the glass sheets are in “perfect” condition.

0.5 00.50.5

( 0) 0.6070!

eP X e

Page 39: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

2) Sheets with 2 or more flaws are scrapped by the company. Find this probability.

About 9% of the glass sheets need to be scrapped and recycled through the company’s manufacturing process.

0.5 0 0.5 1

( 2) 1 ( 0) ( 1)

0.5 0.51 0.090

0! 1!

P X P X P X

e e

Page 40: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

0 2 4 6 8 10

0.0

0.1

0.2

0.3

0.4

0.5

0.6

Poisson Probabilities with lambda=0.5

x

z

0 2 4 6 8 10

0.6

0.7

0.8

0.9

1.0

Poisson Cumulative Probabilities with lambda=0.5

x

y

Page 41: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

3) Looking at 3 sheets of glass, what is the probability that we can find a total of 4 flaws?

• This is a new Poisson random variable. λ=1.5

1.5 41.5( 4)

4!

eP Y

Page 42: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Something to think about:

• How many sheets of glass we need to inspect to have a 90% chance of finding at least one flaws?

Page 43: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)
Page 44: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

Exercise

• In a certain city, medical expenses are given as the reason for 75% of all personal bankruptcies. Calculate the probability that medical expenses will be given as the reason for two of the next three personal bankruptcies filed in that city.

Page 45: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)

To get a driver’s license, you must first pass a written examination. If you fail in an exam, you can take it the second time until you pass it. Suppose you fail an exam with probability 0.3, and all the tests are independent.

1) What is the probability that you have to take the test twice in order to pass the written exam?

2) What is the probability that you have to take the test more than 2 times in order to pass the written exam?

Page 46: Ch 5 Probability: The Mathematics of Randomness. 5.1.1 Random Variables and Their Distributions A random variable is a quantity that (prior to observation)