Acts 372 Unit 2
Acts 372 Unit 2
Software Packages
UNIT 2
Emmanuel Harris
[email protected] // 020 2470867
Feb 2016
UNIT 2
• DISCRETE DISTRIBUTIONS
1. BINOMIAL DISTRIBUTION
2. POISSON DISTRIBUTION
3. POISSON APPROXIMATION TO BINOMIAL
4. GEOMETRIC DISTRIBUTION
5. HYPERGEOMETRIC DISTRIBUTION
6. NEGATIVE BINOMIAL DISTRIBUTION
1
DISCRETE PROBABILITY DISTRIBUTIONS
A probability distribution for a discrete random variable X is
a formula, graph, table or any device that specifies the
probability associated with each possible value of X
Discrete Distributions under study
❖ BINOMIAL DISTRIBUTION
❖POISSON DISTRIBUTION
❖GEOMETRIC DISTRIBUTION
❖HYPERGEOMETRIC DISTRIBUTION
❖ NEGATIVE BINOMIAL
2
BINOMIAL DISTRIBUTION
Its used to model experiments consisting of a sequence of
observations of identical and independent trials, each of which
results in one of the possible outcomes.
A random variable X is said to have a Binomial distribution based
on the n trials with probability of success p if and only if
Where 𝑛
𝑃 𝑋=𝑥 = 𝑃𝑥 1 − 𝑃 𝑛−𝑥 , 𝑥 = 0,1,2, … , 𝑛
𝑥
𝜇 = 𝐸 𝑋 = 𝑛𝑝 𝑎𝑛𝑑 𝜎 2 = 𝑉𝑎𝑟 𝑋 = 𝑛𝑝(1 − 𝑝)
• Each trial can have only two outcomes or outcomes that can be
reduced to two outcomes. The outcomes are usually considered
as a success or a failure.
• There is a fixed number of trials.
• The outcomes of each trial are independent of each other.
• The probability of a success must remain the same for each trial.
4
EXAMPLE
For a random variable 𝑋~𝐵(12, 0.3).Find the following
probabilities,
(i) 𝑃(𝑋 = 4)
(ii) 𝑃 𝑋 < 3
(iii) 𝑃 𝑋 ≤ 3
(iv) 𝑃 𝑋 ≥ 4
(v) 𝑃 𝑋 > 4
(vi) 𝑃 2 < 𝑋 < 6
(vii) 𝑃 2 ≤ 𝑋 < 6
(viii)𝑃 2 ≤ 𝑋 ≤ 6
(ix) 𝑃 2 < 𝑋 ≤ 6
5
12
(i) 𝑃 𝑋 = 4 = 4
0.34 0.78 = 0.23114
R-Code
> dbinom(4,12,0.3)
[1] 0.2311397
(ii) 𝑃 𝑋 < 3 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 + 𝑃 𝑋 = 2
=0.2528
R-Code
> pbinom(2,12,0.3)
[1] 0.2528153
6
(iii)𝑃 𝑋 ≤ 3 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 + 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3
=0.49252
R-Code
> sum(dbinom(0:3,12,0.3))
[1] 0.4925158
R-Code
> sum(dbinom(3:5,12,0.3))
[1] 0.6293359
8
(vii) 𝑃 2 ≤ 𝑋 < 6 = 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3 + 𝑃 𝑋 = 4 +
𝑃 𝑋=5
=0.79713
• R-Code
• > sum(dbinom(2:5,12,0.3))
• [1] 0.7971262
(viii)𝑃 2 ≤ 𝑋 ≤ 6 = 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3 + 𝑃 𝑋 = 4 +
𝑃 𝑋 =5 +𝑃 𝑋 =6
=0.876374
• R-Code
• > sum(dbinom(2:6,12,0.3))
• [1] 0.8763741
9
(ix)𝑃 2 < 𝑋 ≤ 6 = 𝑃 𝑋 = 3 + 𝑃 𝑋 = 4 + 𝑃 𝑋 = 5 + 𝑃 𝑋 = 6
=0.708589
• R-Code
• > sum(dbinom(3:6,12,0.3))
• [1] 0.7085838
10
EXAMPLE
In a certain hospital, 53% of all birth are boys. If six babies born
in this hospital are selected at random, find the probability that:
(A) two of the babies selected are boys
(B) more than four of the babies are selected are boys
(C) at most three are boys
(D) Between 3 and 5 boys inclusive
(E) Fewer than 2 are boys
(F) More than one but less than four are boys
11
Solution
6
(a) 𝑃 𝑋 = 2 = 0.53 2 0.47 4 = 0.20561
2
• R- code
• > dbinom(2,6,0.53)
• [1] 0.2056054
(b) 𝑃 𝑋 > 4 = 𝑃 𝑋 = 5 + 𝑃 𝑋 = 6
6 6
0.53 5 0.47 1 + 0.53 6 0.47 0 = 0.1401
5 6
• R- code
• >sum(dbinom(5:6,6,0.53))
• [1] 0.1400955
12
(c) 𝑃 𝑋 ≤ 3 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 + 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3
=0.59845
• R-Code
• > sum(dbinom(0:3,6,0.53))
• [1] 0.5984534
(d) 𝑃 3 ≤ 𝑋 ≤ 5
6 6 6
0.53 5 0.47 1 + 0.53 4
0.47 2
+ 0.53 3
0.47 3 =0.68852
5 4 3
• R-Code
• > sum(dbinom(3:5,6,0.53))
• [1] 0.688519
13
6
(e) 𝑃 𝑋 < 2 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 = 0.53 0 0.47 6 +
6 0
0.53 0.47 =0.08371
1 5
1
• R-Code
• > pbinom(1,6,0.53)
• [1] 0.08371093
• R-Code
• > pbinom(3,6,0.53)-pbinom(1,6,0.53)
• [1] 0.5147425
14
POISSON DISTRIBUTION
The Poisson distribution for a random variable X, representing the
number of occurrence of an event in a given interval of time,
space or volume is defined by
𝝁𝒙 𝒆−𝝁
𝑷 𝒙 = , 𝒙 = 𝟎, 𝟏, 𝟐, . . , 𝒂𝒏𝒅 𝝁 > 𝟎
𝒙!
15
PROPERTIES
• It consist of counting the number of times a particular event
occurs during a given unit of time, area, volume or space
16
EXAMPLE 1
The number of accidents at a certain intersection assumes a poison
distribution with 𝜇 = 3.5. find the following,
(i) 𝑃(𝑋 = 2)
(ii) 𝑃 𝑋 < 2
(iii)𝑃(𝑋 ≤ 2)
(iv)𝑃(𝑋 > 2)
(v) 𝑃(𝑋 ≥ 1)
(vi) 𝑃 1 < 𝑋 < 4
(vii)𝑃(1 ≤ 𝑋 ≤ 4)
(viii)𝑃 1 ≤ 𝑋 < 4
(ix)𝑃(2 < 𝑋 ≤ 5)
17
SOLUTION
3.52 𝑒 −3.5
(i) 𝑃 𝑋 = 2 = = 0.18496
2!
• R-Code
• > dpois(2,3.5)
• [1] 0.184959
3.51 𝑒 −3.5 3.50 𝑒 −3.5
(ii) 𝑃 𝑋 < 2 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 = + = 0.13589
1! 0!
• R-Code
• > ppois(1,3.5)
• [1] 0.1358882
18
(iii) 𝑃 𝑋 ≤ 2 = 𝑃 𝑋 = 0 + 𝑃 𝑋 = 1 + 𝑃 𝑋 = 2
3.50 𝑒 −3.5 3.51 𝑒 −3.5 3.52 𝑒 −3.5
= + + = 0.32085
0! 1! 2!
• R-Code
• > ppois(2,3.5)
• [1] 0.3208472
(vii) 𝑃 1 ≤ 𝑋 ≤ 4 = 𝑃 𝑋 = 1 + 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3 + 𝑃 𝑋 = 4
= 0.695243
• R-Code
• > sum(dpois(1:4,3.5))
• [1] 0.6952476
20
3.51 𝑒 −3.5 3.52 𝑒 −3.5 3.53 𝑒 −3.5
(viii) 𝑃 1 ≤ 𝑋 < 4 = + + = 0.506435
1! 2! 3!
• R-Code
• > sum(dpois(1:3,3.5))
• [1] 0.5064353
(ix)𝑃 1 < 𝑋 ≤ 4 = 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3 + 𝑃 𝑋 = 4
3.52 𝑒 −3.5 3.53 𝑒 −3.5 3.54 𝑒 −3.5
+ + = 0.58956
2! 3! 4!
• R-Code
• > dpois(2,3.5)+dpois(3,3.5)+dpois(4,3.5)
• [1] 0.5895567
21
EXAMPLE 2
The number of telephone calls received by an office average
4 per minute. Find the probability that;
(A)No call will arrive in a given one-minute period
(B)At least two calls will arrive in a given one- minute period
(c)More than two calls will arrive in a given two-minute period
(d)There will be more than one but less than four arrivals in two-
minute period
22
SOLUTION
40 𝑒 −4
a) 𝑋~𝑃𝑜𝑖𝑠 𝑥, 𝜇 = 4 = 𝑃 𝑋 = 0 = = 0.0183156
0!
• R- Code
• > dpois(0,4)
• [1] 0.01831564
b) 𝑷 𝒙 ≥ 𝟐 = 𝟏 − 𝑷 𝒙 < 𝟐 = 𝟏 − 𝑷 𝑿 = 𝟎 + 𝑷 𝑿 = 𝟏
40 𝑒 −4 41 𝑒 −4
𝟏− ( + ) = 0.90842
0! 1!
• R-Code
• > 1-ppois(1,4)
• [1] 0.9084218
23
Cont’
c) For every two-minute 𝜇 = 2 × 4 = 8
𝑋~𝑃𝑜𝑖𝑠(𝑥, 𝜇 = 8)
𝑃 𝑥 > 2 =1−𝑃 𝑥 ≤2 = 1− 𝑃 𝑋 =0 +𝑃 𝑋 = 1 +𝑃 𝑋 = 2 = 0.98624
• R- Code
• > 1-ppois(2,8)
• [1] 0.986246
• R-Code
• > sum(dpois(2:3,8))
• [1] 0.03936095
24
POISSON APPROXIMATION TO THE BINOMIAL
The use of binomial for the calculation of certain probabilities
becomes very cumbersome to handle when n is very large and
the probability of success p, becomes very small. Hence, the use
of Poisson distribution to approximate the binomial distribution in
such instances.
(i) P(𝑋 = 4)
(ii) P(𝑋 ≥ 3)
(iii) P(𝑋 < 4)
(iv) P(𝑋 > 4)
30
SOLUTION
3
(i) 𝑃 𝑋 = 4 = 0.28 0.72 = 0.10451
• R-Code
• > dgeom(3,0.28)
• [1] 0.1045094
(ii) 𝑃 𝑋 ≥ 3 = 1 − 𝑃 𝑋 ≤ 2 = 1 − [𝑃 𝑋 = 1 + 𝑃 𝑋 = 2 ]
1 − 0.28 0.72 0 + 0.28 0.72 1 = 0.5184
• R-Code
• > 1-pgeom(1,0.28)
• [1] 0.5184
31
(iii) 𝑃 𝑋 < 4 = 𝑃 𝑋 = 1 + 𝑃 𝑋 = 2 + 𝑃 𝑋 = 3
0.28 0.72 0 + 0.28 0.72 1 + 0.28 0.72 2 = 0.626752
• R-Code
• > pgeom(2,0.28)
• [1] 0.626752
(iv) 𝑃 𝑋 > 4 = 1 − 𝑃 𝑋 ≤ 4
1 − [ 0.28 0.72 0 + 0.28 0.72 1 + 0.28 0.72 2 + 0.28 0.72 3
=1 − 0.73126 = 0.2687
• R-Code
• > 1-pgeom(3,.28)
• [1] 0.2687386
32
EXAMPLE 2
A large consignment of items contains 20% that are defective.
Items are drawn until a defective item is found. Find the
probability that;
(a) 4 draws are required
(b) Less than 3 draws are required
(c) At least 2 draws are required
(d)4 to 7 draws are required
33
SOLUTION
𝑋~𝐺𝑒𝑜𝑚(𝑥 − 1, 𝑝 = 0.2)
a) P X = 4 = 0.20 (0.8)3 = 0.1024
• > dgeom(3,0.2)
• [1] 0.1024
• R-code
• > 1-dgeom(0,.2)
• [1] 0.8
(d) 𝑃 4 ≤ 𝑋 ≤ 7 = 𝑃 𝑋 = 4 + 𝑃 𝑋 = 5 + 𝑃 𝑋 = 6 + 𝑃 𝑋 = 7
= 0.30228
• R-Code
• > sum(dgeom(3:6,0.2))
• [1] 0.3022848
35
THE HYPERGEOMETRIC DISTRIBUTION
When a probability experiment has two outcomes and the items
are selected without replacement. When there are two groups
of items such that there are a items in the first group and b items
in the second group, so that the total number of items is a+b=N,
the probability of selecting x items from the first group and k-x
items from the second group is
𝒂 𝑵−𝒂
𝒙 𝒌−𝒙
𝑷 𝑿=𝒙 = 𝑵 , 𝒙 = 𝟎, 𝟏, 𝟐, … , 𝒎𝒊𝒏(𝒂, 𝒌)
𝒌
37
EXAMPLE
Among the 120 applicants for a job, only 80 are actually
qualified. If five of the applicants are randomly selected for an
in-depth interview, find the probability that
(a)Only two of the five will be qualified for the job
(b) At most one will be qualified for the job
(c) At least four will be qualified for the job
(d) More than four will be qualified
38
SOLUTION
Using the R-Code 𝑑ℎ𝑦𝑝𝑒𝑟(𝑥, 𝑘, 𝑁 − 𝑘, 𝑛)
80 40
2 3
a) 𝑃 𝑋 = 2 = 120 = 0.1638
5
R-Code
• > dhyper(2,80,40,5)
• [1] 0.1638216
80 40 80 40
b) 𝑃 𝑋 ≤ 1 = 0
120
5
+ 1
120
4
= 0.04182
5 5
• R-Code
• > phyper(1,80,40,5)
39
• [1] 0.04181599
80 40 80 40
(C)𝑃 𝑋 ≥ 4 = 𝑃 𝑋 = 4 + 𝑃 𝑋 = 5 = 4
120
1
+ 5
120
0
= 0.4581
5 5
• R-Code
• > sum(dhyper(4:5,80,40,5))
• [1] 0.458097
80 40
(d)𝑃 𝑋 > 4 = 5
120
0
= 0.12614
5
• R-Code
• dhyper(5,80,40,5)
• [1] 0.1261426
40
THE NEGATIVE BINOMIAL
• If the experiment is repeated indefinitely and the trials are
independent of each other, then the random variable X, the
number of trials at which the 𝑘 𝑡ℎ success occurs, has a
negative binomial distribution with parameters k and p. The
probability mass function of X is
𝑥−1 𝑘 𝑥−𝑘
𝑃 𝑋=𝑥 = 𝑝 1−𝑝 , 𝑥 = 𝑘, 𝑘 + 1, 𝑘 + 2 … ; 0 < 𝑝 < 1
𝑘−1
where p is the probability of success and q is the probability
of success.
• In R, we use >dnbinom(x-k,k,𝒑) when finding exactly the
probability of outcomes and we use >pnbinom(x-k,k,𝒑) when
finding the probability of at most X outcomes.
41
EXAMPLE
In a sequence of independent trials, the probability of success
is 0.3. Find the probability that;
(a)Exactly 10 repetitions are necessary to obtain the third
success
(b)At most 3 repetitions are required to obtain the second
success
(c) Five repetitions are needed to obtain the second success
(d) At least six trials are needed to obtain the fourth success
(e) Two trials are required to obtain the first success
42
Solution
a) x=10, k = 3 Using the 𝑑𝑛𝑏𝑖𝑛𝑜𝑚 𝑥 − 𝑘, 𝑘, 𝑝
10 − 1
𝑃 𝑋 = 10 = 0.3 3 1 − 0.3 7 = 0.080048
3−1
• R-code
• > dnbinom(7,3,.3)
• [1] 0.08004838
= 0.21
• R-code
• > dnbinom(1,1,0.3)
• [1] 0.21
45
Thank You