Download Binomial Random Variables

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Statistics wikipedia , lookup

History of statistics wikipedia , lookup

Ars Conjectandi wikipedia , lookup

Inductive probability wikipedia , lookup

Probability interpretations wikipedia , lookup

Probability wikipedia , lookup

Transcript
•
Binomial Random
Variables
Overview
A special case of a Discrete Random Variable is the
Binomial
•
•
•
•
•
Dr Tom Ilvento
Department of Food and Resource Economics
•
•
•
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
•
•
•
•
•
•
Conduct an experiment n times and observe
the number x of times that Success occurs
Yes or No
Cured or not Cured
Formula
Probability Table
And the solution for the Mean and Variance is much
easier to solve
2
Characteristics of a Binomial
Distribution
Binomial Random Variable
•
Success or Failure
If the discrete random variable is a binomial, we have
some easier ways to solve for probabilities
•
•
•
•
This happens when the result of the experiment is a
dichotomy
•
•
3
•
•
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
Example of a Binomial Random
Variable: Marketing Survey
Example of a Binomial Random
Variable: Fitness Example
•
•
Marketing survey of 100 randomly chosen consumers
•
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 number of 100 who choose the new brand
•
•
•
Record their preferences for a new and an old diet soda –
ask them to choose their preference
This is a binomial random variable
Conduct an experiment 100 times and observe the
number x of times that the subject chooses the new
brand
Let X be the number who pass the minimum requirements
Find the probability distribution for X
Conduct an experiment 4 times and observe the
number x of times that pass occurs
5
6
Can you solve it – the probability that
exactly 1 person passes the test?
How to solve this using the strategy
of a Discrete Random Variable
1. List the events
•
Count the ways we could
have only one pass, and
three failures
•
SFFF FSFF FFSF FFFS
•
Assign probabilities to this
event
•
For each combination, the probabilities
are:
2. List the sample points that refer to that event
3. Calculate the probabilities
•
•
p = .1
and q = (1.0 - .1) = .9
Event X
Sample Points
Probability
All Fail
FFFF
(.9)(.9)(.9)(.9) = .6561
I multiply through on the probabilities because each
trial is independent of the others
•
•
.1*.9*.9*.9
And there are four ways to get one
pass
•
•
7
4[.1*.9*.9*.9] = .2916
Another way to write it is
•
4[.1*.93] = .2916
8
Let’s finish solving for the whole table
Probability Distribution
Event X
Sample Points
Probability
0
All Fail
FFFF
(.9)(.9)(.9)(.9) = .6561
1
One passes
SFFF FSFF FFSF FFFS
4[(.1)(.9)3] = .2916
2
Two Pass
SSFF SFSF SFFS FSSF
FSFS FFSS
6[(.1)2(.9)2] = .0486
3
Three Pass
SSSF FSSS SFSS SSFS
4[(.1)3(.9)] = .0036
4
Four Pass
SSSS
(.1)(.1)(.1)(.1) = .0001
•
•
•
•
•
•
9
2
3
4
P(X)
0.6561
0.2916
0.0486
0.0036
0.0001
P = .2916
When x =2 Two pass
P =.0486
When x=3 Three pass
P = .0036
When x=4 Four pass
P = .0001
0.350
0.175
0
1
0
1
2
3
4
P(X)
0.6561
0.2916
0.0486
0.0036
0.0001
•
•
P(x=0) = .6561
2
3
4
10
Sometimes the number of trials gets large
We can also use the binomial probability distribution
formula to generate the probabilities
•
•
•
•
P(x=3) = .0036
What is the probability that 2 or more adults pass the test?
•
0.525
X
Find the probability that 3 of 4 adults pass the test
•
•
1
When x = 1 One Pass
0.700
Binomial Probability Distribution
Formula
Find the probability that none of the adults pass the test
•
•
0
P = .6561
0
Fitness Example
X
When x = 0 All Fail
P(X)
The number of times that an adult passes in a sample of
four
P(x=2) + P(x=3) + P(x=4) = .0486 + .0036 + .0001 = .0523
•
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:
P( x) =
11
n!
( p) x (q) n ! x
x!(n ! x)!
12
For x=3 in the fitness example, n=4, p=.1
What defines the Binomial
Distribution?
•
•
•
•
n!
( p) x (q) n ! x
x!(n ! x)!
p = Probability of a success on a single trial
q = (1-p) probability of failure
P(3) =
n = number of trials
x = number of successes in n trials
This part reflects the
probabilities with each
combination
n!
P( x) =
( p) x (q) n ! x
x!(n ! x)!
Note: it uses the
Combinatorial Rule as
the first part of the
formula
P(3) =
4 ! 3! 2 !1
(.1) 3 (.9) 4"3
3!
2
!1
1
(
)( )
I will get you started
P(2) =
•
•
The four is how many combinations of 3 success in 4
•
The probability, .0036, is the exact same one we
calculated earlier
The last part of the formula is the probability associated
with each of these combinations
14
Mean and Variance for a
Binomial Random Variable
n!
( p) x (q) n ! x
x!(n ! x)!
•
Since a binomial is only a dichotomy, the formulas for the
mean and the standard deviation will simplify
•
•
•
4!
(.1) 2 (.9) 4"2
2!(4 " 2)!
•
!
P(2) = 6(.0081) = .0486
P(3) = 4(.0009) = .0036
P(3) = 4(.1) 3 (.9) 4!3
13
P( x) =
P(3) = 4(.001)(.9)
24
(.1) 3 (.9) 4!3
6
Your Try it: For x=2 in the fitness
example, n=4, p=.1
•
P( x) =
4!
P(3) =
(.1) 3 (.9) 4!3
3!(4 ! 3)!
15
From
To
µ = !(x!P(x))
µ = 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:
and ! = .60
!2 = 4*.1* .9 = .36
16
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) = " xi ! P ( xi ) = µ
i =1
E(x) = .4
•
Binomial approach
•
•
•
n
E(x) = (0)(.6561) + (1)(.2916) + (2)
(.0486) + (3)(.0036) + (4)(.0001)
•
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
The Binomial approach is much
easier
If I know my Discrete Random Variable is
distributed as a binomial random variable, it will
make things much easier
•
17
E(x) = n·p·q = 4·(.1)(.9) = .36
The Binomial approach is much
easier
If I know my Discrete Random Variable is
distributed as a binomial random variable, it will
make things much easier
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.
•
•
18
Nitrous Oxide Example
•
How to solve for these probabilities?
X
q = .4
P(X)
Let X = number of dentists in a random sample of five
dentists use use laughing gas.
•
•
p = .6 and
i =1
Binomial approach
•
E(x) = n·p = 4·(.1) = .4
n
E[( x " µ ) 2 ] = # ( xi " µ ) 2 P ( xi ) = ! 2
0
1
2
3
4
5
0.0102 0.0768 0.2304 0.3456 0.2592 0.0778
n=5
This is a Binomial Random Variable!
P( x) =
Conduct an experiment 5 times and observe the
number x of times that use Nitrous Oxide
19
n!
( p) x (q) n ! x
x!(n ! x)!
20
Probability Distribution for the
Nitrous Oxide Example
X
P(X)
1
2
3
4
5
•
•
•
0.0102 0.0768 0.2304 0.3456 0.2592 0.0778
Probability Distribution of X
µ = 3.00
0.4
!2 = 1.20
0.3
! = 1.01
µ = 5*.6 = 3.00
P(X)
•
•
•
•
•
•
0
Nitrous Oxide Example using
Excel
!2 = 5*.6*.4 = 1.20
•
0.1
! = SQRT(1.20) = 1.01
Click on the Worksheet Problem
This worksheet is designed to
solve problems up to n=50, for
any value of p
You enter in:
•
•
0.2
0
Open up the file, BINOM.xls
•
0
1
2
3
4
p=
q=
n=
0.6000
0.4000
5
Mean
Variance
Std Dev
3.0000
1.2000
1.0954
Reverse
X
p(X)
0
1
2
3
4
5
0.0102
0.0768
0.2304
0.3456
0.2592
0.0778
Cum p(X)
0.0102
0.0870
0.3174
0.6630
0.9222
1.0000
Cum p(>=X)
1.0000
0.9898
0.9130
0.6826
0.3370
0.0778
p = .6
n=5
The spreadsheet will do the rest!
5
21
22
Binomial Formula using Excel
•
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
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)
BINOMDIST(3,5,.6,TRUE)
BINOMDIST(2,5,.6,TRUE)
•
•
N is the number of independent trials
•
For our example of dentists
= .3174
BINOMDIST(2,5,.6,FALSE)
•
•
23
cumulative probability up to and including 2 successes
the exact probability of X successes in N trials
= .2304
24
Binomial Table
for n = 5
Binomial Table
• 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
The values shown are cumulative probabilities for the probability of x (denoted as k in the 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
•
•
•
x
0
1
2
3
4
5
0.01
0.951
0.999
1.000
1.000
1.000
1.000
•
P = .01, .05, .1, .2, .3, …, .95, .99
0.05
0.774
0.977
0.999
1.000
1.000
1.000
0.10
0.590
0.919
0.991
1.000
1.000
1.000
0.20
0.328
0.737
0.942
0.993
1.000
1.000
PROBABILITIES (p)
0.30
0.40
0.50
0.168 0.078 0.031
0.528 0.337 0.188
0.837 0.683 0.500
0.969 0.913 0.813
0.998 0.990 0.969
1.000 1.000 1.000
0.60
0.010
0.087
0.317
0.663
0.922
1.000
0.70
0.002
0.031
0.163
0.472
0.832
1.000
0.80
0.000
0.007
0.058
0.263
0.672
1.000
0.90
0.000
0.000
0.009
0.081
0.410
1.000
0.95
0.000
0.000
0.001
0.023
0.226
1.000
The probability associated with p=.3 and x = 4 is .998
•
•
•
x = # of successes as the rows
It is a Cumulative Table
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
25
26
Nitrous Oxide Example
Nitrous Oxide Example
The values shown are cumulative probabilities for the probability of x (denoted as k in the table)
x
0
1
2
3
4
5
•
•
0.01
0.951
0.999
1.000
1.000
1.000
1.000
0.10
0.590
0.919
0.991
1.000
1.000
1.000
0.20
0.328
0.737
0.942
0.993
1.000
1.000
0.60
0.010
0.087
0.317
0.663
0.922
1.000
0.70
0.002
0.031
0.163
0.472
0.832
1.000
0.80
0.000
0.007
0.058
0.263
0.672
1.000
The values shown are cumulative probabilities for the probability of x (denoted as k in the table)
0.90
0.000
0.000
0.009
0.081
0.410
1.000
0.95
0.000
0.000
0.001
0.023
0.226
1.000
0.99
0.000
0.000
0.000
0.001
0.049
1.000
Use the n = 5 Table for p = .6
Solve the probability for x = 3
•
•
•
•
0.05
0.774
0.977
0.999
1.000
1.000
1.000
PROBABILITIES (p)
0.30
0.40
0.50
0.168 0.078 0.031
0.528 0.337 0.188
0.837 0.683 0.500
0.969 0.913 0.813
0.998 0.990 0.969
1.000 1.000 1.000
0.99
0.000
0.000
0.000
0.001
0.049
1.000
x
0
1
2
3
4
5
•
•
P(x " 2) = .317
This is the same value (with some rounding error) that we calculated
using the formula (.3456)
27
•
0.05
0.774
0.977
0.999
1.000
1.000
1.000
0.10
0.590
0.919
0.991
1.000
1.000
1.000
0.20
0.328
0.737
0.942
0.993
1.000
1.000
PROBABILITIES (p)
0.30
0.40
0.50
0.168 0.078 0.031
0.528 0.337 0.188
0.837 0.683 0.500
0.969 0.913 0.813
0.998 0.990 0.969
1.000 1.000 1.000
0.60
0.010
0.087
0.317
0.663
0.922
1.000
0.70
0.002
0.031
0.163
0.472
0.832
1.000
0.80
0.000
0.007
0.058
0.263
0.672
1.000
0.90
0.000
0.000
0.009
0.081
0.410
1.000
0.95
0.000
0.000
0.001
0.023
0.226
1.000
0.99
0.000
0.000
0.000
0.001
0.049
1.000
Use the n = 5 Table for p = .6
Solve the probability for x > 3
•
•
P(x " 3) = .663
P(x=3) = .663 - .317 = .346
0.01
0.951
0.999
1.000
1.000
1.000
1.000
P(x " 3) = .663
P(x>3) = 1 - .663 = .337
Solve the probability for x " 2
•
P(x " 2) = .317
28
The Rare Event Approach
•
What if we had 5 dentists selected randomly and none of
them used nitrous oxide?
•
•
•
Summary
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????
•
The Binomial is a special form of the discrete random
variable
•
•
There are other discrete random variables - poisson
•
For probabilities you can use:
If you know it is a Binomial Random Variable it makes it
easy to solve for probabilities, the mean and the variance
•
•
Or was the assumption wrong – that p =.6?
•
29
The Binomial Formula
The Binomial Tables
Excel also has functions to solve for binomials
30