binomial random variables - ilvento web page

8
Binomial Random Variables Dr Tom Ilvento Department of Food and Resource Economics Overview A special case of a Discrete Random Variable is the Binomial This happens when the result of the experiment is a dichotomy Success or Failure Yes or No Cured or not Cured If the discrete random variable is a binomial, we have some easier ways to solve for probabilities Formula Probability Table And the solution for the Mean and Variance is much easier to solve 2 Binomial Random Variable In many cases the responses to an experiment are dichotomous Sucess/Failure Yes/No Alive/Dead Support/Don’t Support When our focus is conducting an experiment n times independently and observing the number x of times that one of the two outcomes occurs (Success) And the probability of success, p, remains the same from trial to trial This X is a Binomial Random Variable We can exploit this by using known formulas for a Binomial Probability Distribution 3 Conduct an experiment n times and observe the number x of times that Success occurs Characteristics of a Binomial Distribution The experiment consists of n identical trials There are only two outcomes on each trial. Outcomes can be denoted as S for Success F for Failure The probability of S (success) remains the same from trial to trail Denoted as p the proportion The probability of F (failure) Denoted as q q=(1-p) The trials are independent of each other The binomial random variable x is the number of Successes in n trials 4

Upload: others

Post on 12-Sep-2021

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Binomial Random Variables - Ilvento Web page

Binomial Random Variables

Dr Tom IlventoDepartment of Food and Resource Economics

Overview• A special case of a Discrete Random Variable is the

Binomial

• This happens when the result of the experiment is a dichotomy

• Success or Failure

• Yes or No

• Cured or not Cured

• If the discrete random variable is a binomial, we have some easier ways to solve for probabilities

• Formula

• Probability Table

• And the solution for the Mean and Variance is much easier to solve

2

Binomial Random Variable

• In many cases the responses to an experiment are dichotomous

• Sucess/Failure

• Yes/No

• Alive/Dead

• Support/Don’t Support

• When our focus is conducting an experiment n times independently and observing the number x of times that one of the two outcomes occurs (Success)

• And the probability of success, p, remains the same from trial to trial

• This X is a Binomial Random Variable

• We can exploit this by using known formulas for a Binomial Probability Distribution

3

Conduct an experiment n times and observethe number x of times that Success occurs

Characteristics of a Binomial Distribution

• The experiment consists of n identical trials

• There are only two outcomes on each trial. Outcomes can be denoted as

• S for Success

• F for Failure

• The probability of S (success) remains the same from trial to trail

• Denoted as p the proportion

• The probability of F (failure)

• Denoted as q q=(1-p)

• The trials are independent of each other

• The binomial random variable x is the number of Successes in n trials 4

Page 2: Binomial Random Variables - Ilvento Web page

Example of a Binomial Random Variable: Marketing Survey

• Marketing survey of 100 randomly chosen consumers

• Record their preferences for a new and an old diet soda – ask them to choose their preference

• Let x be number of 100 who choose the new brand

• This is a binomial random variable

5

Conduct an experiment 100 times and observe the number x of times that the subject chooses the new brand

Example of a Binomial Random Variable: Fitness Example

• Heart Association says only 10% of adults over 30 can pass the fitness test

• Suppose 4 people over 30 are selected at random

• Let X be the number who pass the minimum requirements

• Find the probability distribution for X

6

Conduct an experiment 4 times and observe the number x of times that pass occurs

How to solve this using the strategy of a Discrete Random Variable

1. List the events

2. List the sample points that refer to that event

3. Calculate the probabilities

• p = .1 and q = (1.0 - .1) = .9

• I multiply through on the probabilities because each trial is independent of the others 7

Event X Sample Points Probability

All Fail FFFF (.9)(.9)(.9)(.9) = .6561

Can you solve it – the probability that exactly 1 person passes the test?

• Count the ways we could have only one pass, and three failures

• Assign probabilities to this event

8

• SFFF FSFF FFSF FFFS

• For each combination, the probabilities are:

• .1*.9*.9*.9

• And there are four ways to get one pass

• 4[.1*.9*.9*.9] = .2916

• Another way to write it is

• 4[.1*.93] = .2916

Page 3: Binomial Random Variables - Ilvento Web page

Let’s finish solving for the whole table

The number of times that an adult passes in a sample of four

9

Event X Sample Points Probability

0All Fail

FFFF (.9)(.9)(.9)(.9) = .6561

1One passes

SFFF FSFF FFSF FFFS 4[(.1)(.9)3] = .2916

2Two Pass

SSFF SFSF SFFS FSSF FSFS FFSS

6[(.1)2(.9)2] = .0486

3Three Pass

SSSF FSSS SFSS SSFS 4[(.1)3(.9)] = .0036

4Four Pass

SSSS (.1)(.1)(.1)(.1) = .0001

Probability Distribution

• When x = 0 All Fail P = .6561

• When x = 1 One Pass P = .2916

• When x =2 Two pass P =.0486

• When x=3 Three pass P = .0036

• When x=4 Four pass P = .0001

10

0

0.175

0.350

0.525

0.700

0 1 2 3 4

P(X

)

X 0 1 2 3 4

P(X) 0.6561 0.2916 0.0486 0.0036 0.0001

Fitness Example

• Find the probability that none of the adults pass the test

• P(x=0) = .6561

• Find the probability that 3 of 4 adults pass the test

• P(x=3) = .0036

• What is the probability that 2 or more adults pass the test?

• P(x=2) + P(x=3) + P(x=4) = .0486 + .0036 + .0001 = .0523

11

X 0 1 2 3 4

P(X) 0.6561 0.2916 0.0486 0.0036 0.0001

Binomial Probability Distribution Formula

• Sometimes the number of trials gets large

• We can also use the binomial probability distribution formula to generate the probabilities

• It uses factorial notation

• n! = n(n-1)(n-2)…(n-(n-1))

• 5! = 5x4x3x2x1 = 120

• 0! = 1, 1!=1, 2!=2x1=2, …

• The formula for any x in n trials is:

12

xnxqp

xnx

nxP

!

!= )()(

)!(!

!)(

Page 4: Binomial Random Variables - Ilvento Web page

What defines the Binomial Distribution?

• p = Probability of a success on a single trial

• q = (1-p) probability of failure

• n = number of trials

• x = number of successes in n trials

13

xnxqp

xnx

nxP

!

!= )()(

)!(!

!)(

Note: it uses the Combinatorial Rule as

the first part of the formula

This part reflects the probabilities with each

combination

For x=3 in the fitness example, n=4, p=.1

• The four is how many combinations of 3 success in 4

• The last part of the formula is the probability associated with each of these combinations

• The probability, .0036, is the exact same one we calculated earlier

14

xnxqp

xnx

nxP

!

!= )()(

)!(!

!)(

343 )9(.)1(.)!34(!3

!4)3( !

!=P

P(3) =4 ! 3 ! 2 !1

3 ! 2 !1( ) 1( )(.1)

3(.9)

4"3

P(3) =24

6(.1)

3(.9)

4!3

P(3) = 4(.1)3(.9)

4!3

P(3) = 4(.001)(.9)

P(3) = 4(.0009) = .0036

Your Try it: For x=2 in the fitness example, n=4, p=.1

• I will get you started

15

xnxqp

xnx

nxP

!

!= )()(

)!(!

!)(

!

P(2) =4!

2!(4 " 2)!(.1)

2(.9)

4"2

P(2) = 6(.0081) = .0486

Mean and Variance for a Binomial Random Variable

• Since a binomial is only a dichotomy, the formulas for the mean and the standard deviation will simplify

• From µ = !(x!P(x))

• To µ = n!p

• Our fitness example: µ = 4*.1 = .4

• The Variance changes from

• From "2 = ![(x-µ)2!P(x))]

• To !2 = n*p*q

• Our fitness example: !2 = 4*.1* .9 = .36

• and ! = .60 16

Page 5: Binomial Random Variables - Ilvento Web page

I could have solved for the mean using the formula for discrete random variables

• To solve for the mean I would use this formula from the discrete random variable lecture:

• E(x) = (0)(.6561) + (1)(.2916) + (2)(.0486) + (3)(.0036) + (4)(.0001)

• E(x) = .4

• Binomial approach

• E(x) = n·p = 4·(.1) = .4

• The Binomial approach is much easier

17

µ=!="=

n

i

iixPxxE

1

)()(

If I know my Discrete Random Variable is distributed as a binomial random variable, it will make things much easier

I could have solved for the variance using the formula for discrete random variables

• To solve for the variance I would have:

• E(x-µ)2 = (0 -.4)2(.6561) + (1-.4)2

(.2916) + (2-.4)2(.0486) + (3-.4)2

(.0036) + (4-.4)2(.0001)

• !2 = .36

• Binomial approach

• E(x) = n·p·q = 4·(.1)(.9) = .36

• The Binomial approach is much easier

18

If I know my Discrete Random Variable is distributed as a binomial random variable, it will make things much easier

2

1

22 )()(])[( !µµ ="=" #=

n

i

iixPxxE

Return to the Nitrous Oxide Example

• Suppose we were recording the number of dentists that use nitrous oxide (laughing gas) in their practice

• We know that 60% of dentists use the gas.

• p = .6 and q = .4

• Let X = number of dentists in a random sample of five dentists use use laughing gas.

• n = 5

• This is a Binomial Random Variable!

19

Conduct an experiment 5 times and observe the number x of times that use Nitrous Oxide

Nitrous Oxide Example

• How to solve for these probabilities?

20

xnxqp

xnx

nxP

!

!= )()(

)!(!

!)(

X 0 1 2 3 4 5

P(X) 0.0102 0.0768 0.2304 0.3456 0.2592 0.0778

Page 6: Binomial Random Variables - Ilvento Web page

Probability Distribution for the Nitrous Oxide Example

• µ = 3.00

• !2 = 1.20

• ! = 1.01

• µ = 5*.6 = 3.00

• !2 = 5*.6*.4 = 1.20

• ! = SQRT(1.20) = 1.0121

X 0 1 2 3 4 5

P(X) 0.0102 0.0768 0.2304 0.3456 0.2592 0.0778

0

0.1

0.2

0.3

0.4

0 1 2 3 4 5

Probability Distribution of X

P(X

)

Nitrous Oxide Example using Excel

• Open up the file, BINOM.xls

• Click on the Worksheet Problem

• This worksheet is designed to solve problems up to n=50, for any value of p

• You enter in:

• p = .6

• n = 5

• The spreadsheet will do the rest!

22

Reverse p = 0.6000

X p(X) Cum p(X) Cum p(>=X) q = 0.4000

0 0.0102 0.0102 1.0000 n = 5

1 0.0768 0.0870 0.9898

2 0.2304 0.3174 0.9130 Mean 3.0000

3 0.3456 0.6630 0.6826 Variance 1.2000

4 0.2592 0.9222 0.3370 Std Dev 1.0954

5 0.0778 1.0000 0.0778

Binomial Formula using Excel

• In Excel, the formula for the Binomial Distribution function is:

• BINOMDIST(X,N,P,cumulative)

• X is the number of successes

• N is the number of independent trials

• P is the probability of success on each trial

• Cumulative is an argument - you enter TRUE or FALSE

• Entering TRUE gives a cumulative probability up to and

including X successes (or 1)

• Entering FALSE gives the exact probability of X successes

in N trials (or 0)

23BINOMDIST(3,5,.6,TRUE)

Binomial Formula using Excel

• For our example of dentists

• BINOMDIST(2,5,.6,TRUE)

• cumulative probability up to and including 2 successes

• = .3174

• BINOMDIST(2,5,.6,FALSE)

• the exact probability of X successes in N trials

• = .2304

24

Page 7: Binomial Random Variables - Ilvento Web page

Binomial Table

• Another way to get probabilities form Binomial Random Variables is via a table

• In exams, I will give you a table which contains cumulative probabilities for n= 5, 6, 7, 8, 9, 10, 15, 20, and 25

• Each table lists values of P across the top

• P = .01, .05, .1, .2, .3, …, .95, .99

• x = # of successes as the rows

• It is a Cumulative Table

25

Binomial Table for n = 5

• The probability associated with p=.3 and x = 4 is .998

• This means that the cumulative probability, or P(x " 4) = .998

• The actual probability of P(x = 4) = .998 - .969 = .029

• You must subtract two values to get the actual probability of x

26

The values shown are cumulative probabilities for the probability of x (denoted as k in the table)

PROBABILITIES (p)

x 0.01 0.05 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 0.95 0.99

0 0.951 0.774 0.590 0.328 0.168 0.078 0.031 0.010 0.002 0.000 0.000 0.000 0.000

1 0.999 0.977 0.919 0.737 0.528 0.337 0.188 0.087 0.031 0.007 0.000 0.000 0.000

2 1.000 0.999 0.991 0.942 0.837 0.683 0.500 0.317 0.163 0.058 0.009 0.001 0.000

3 1.000 1.000 1.000 0.993 0.969 0.913 0.813 0.663 0.472 0.263 0.081 0.023 0.001

4 1.000 1.000 1.000 1.000 0.998 0.990 0.969 0.922 0.832 0.672 0.410 0.226 0.049

5 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000

• The table is arranged cumulatively• For each probability, the value in the cell is the

cumulative probability up to and including X• The last row (in this case for x = 5), the

cumulative probability is 1.000

Nitrous Oxide Example

• Use the n = 5 Table for p = .6

• Solve the probability for x = 3

• P(x " 3) = .663

• P(x " 2) = .317

• P(x=3) = .663 - .317 = .346

• This is the same value (with some rounding error) that we calculated using the formula (.3456) 27

The values shown are cumulative probabilities for the probability of x (denoted as k in the table)

PROBABILITIES (p)

x 0.01 0.05 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 0.95 0.99

0 0.951 0.774 0.590 0.328 0.168 0.078 0.031 0.010 0.002 0.000 0.000 0.000 0.000

1 0.999 0.977 0.919 0.737 0.528 0.337 0.188 0.087 0.031 0.007 0.000 0.000 0.000

2 1.000 0.999 0.991 0.942 0.837 0.683 0.500 0.317 0.163 0.058 0.009 0.001 0.000

3 1.000 1.000 1.000 0.993 0.969 0.913 0.813 0.663 0.472 0.263 0.081 0.023 0.001

4 1.000 1.000 1.000 1.000 0.998 0.990 0.969 0.922 0.832 0.672 0.410 0.226 0.049

5 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000

Nitrous Oxide Example

• Use the n = 5 Table for p = .6

• Solve the probability for x > 3

• P(x " 3) = .663

• P(x>3) = 1 - .663 = .337

• Solve the probability for x " 2

• P(x " 2) = .317

28

The values shown are cumulative probabilities for the probability of x (denoted as k in the table)

PROBABILITIES (p)

x 0.01 0.05 0.10 0.20 0.30 0.40 0.50 0.60 0.70 0.80 0.90 0.95 0.99

0 0.951 0.774 0.590 0.328 0.168 0.078 0.031 0.010 0.002 0.000 0.000 0.000 0.000

1 0.999 0.977 0.919 0.737 0.528 0.337 0.188 0.087 0.031 0.007 0.000 0.000 0.000

2 1.000 0.999 0.991 0.942 0.837 0.683 0.500 0.317 0.163 0.058 0.009 0.001 0.000

3 1.000 1.000 1.000 0.993 0.969 0.913 0.813 0.663 0.472 0.263 0.081 0.023 0.001

4 1.000 1.000 1.000 1.000 0.998 0.990 0.969 0.922 0.832 0.672 0.410 0.226 0.049

5 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000 1.000

Page 8: Binomial Random Variables - Ilvento Web page

The Rare Event Approach

• What if we had 5 dentists selected randomly and none of them used nitrous oxide?

• Given p=.6, this would be a very rare event

• P(x=0) = .010

• This is possible, but not probable

• Was this just by chance????

• Or was the assumption wrong – that p =.6?

29

Summary

• The Binomial is a special form of the discrete random variable

• There are other discrete random variables - poisson

• If you know it is a Binomial Random Variable it makes it easy to solve for probabilities, the mean and the variance

• For probabilities you can use:

• The Binomial Formula

• The Binomial Tables

• Excel also has functions to solve for binomials

30