Chapter 3: Discrete Distributions: Probability and Statistics For Science and Engineering With Examples in R Hongshik Ahn
Chapter 3: Discrete Distributions: Probability and Statistics For Science and Engineering With Examples in R Hongshik Ahn
Distributions
Hongshik Ahn
(1) Random Variable (r.v.)
Definition: any function that assigns a numerical value to each possible
outcome of an experiment
• for
, but
Probability Model: An assumed form of the probability distribution that
describes the chance behavior for a r.v. X
(b)
( 𝑝 isthe parameter)
Cumulative Distribution Function
(CDF)
• CDF of a random variable:
0 0.2401 0.2401
1
1 0.4116
0.4116 0.6517
0.6517
2
2 0.2646
0.2646 0.9163
0.9163
3 0.0756 0.9919
3 0.0756 0.9919
4 0.0081 1
4 0.0081 1
9
Example 3.5
0 0.1 0.1
1
1 0.2
0.2 0.3
0.3
2
2 0.3
0.3 0.6
0.6
3 0.2 0.8
3 0.2 0.8
4 0.2 1
4 0.2 1
(3) Mean and Variance of Discrete R.V.s
Definition: Mean (Expected value) of a discrete r.v. :
𝐸 ( 𝑋 ) =𝜇=∑ 𝑥 𝑓 ( 𝑥 )
all 𝑥
Example 3.6: What is the expected number of heads in three tosses of a
fair coin?
X: # heads in three tosses of a fair coin
0
1
1
2
3
2
Total
3
Total
Example 3.7: Mean of a Bernoulli r.v.:
𝑝 if 𝑥=1
{
𝑓 ( 𝑥 ) = 1 − 𝑝 if 𝑥= 0
0 otherwise
𝜇= 𝐸 ( 𝑋 )=∑ 𝑥𝑓 ( 𝑥 ) =0 ∙ 𝑓 ( 0 ) +1 ∙𝑓 ( 1 )= 𝑝
𝑥
12
𝐸 ( h ( 𝑋 ) ) = ∑ h ( 𝑥 ) 𝑓 ( 𝑥)
a≪ 𝑥
Example 3.9: In flipping 3 balanced coins find
0 0 1/8 0
0 0 1/8 0
1 0 3/8 0
1 0 3/8 0
2 6 3/8 9/4
2 6 3/8 9/4
3 24 1/8 3
3 24 1/8 3
Total 1 21/4
Total 1 21/4
3 9 21
𝐸 ( 𝑋 − 𝑋 ) =0+0+ +3= =5.25
4 4
Variance of a discrete r.v. :
2 2 2
𝑉𝑎𝑟 ( 𝑋 )=𝜎 = 𝐸 [ ( 𝑋 − 𝜇 ) ]=∑ ( 𝑥− 𝜇 ) 𝑓 ( 𝑥 )
all 𝑥
sd
2 2 2 2
Alternatively 𝑉𝑎𝑟 ( 𝑋 )=𝐸 ( 𝑋 ) − 𝜇 =∑ 𝑥 𝑓 ( 𝑥 ) − ∑ 𝑥𝑓 ( 𝑥 )
all 𝑥 [ ]
all 𝑥
2 2 2 2 2
Proof:
2 2 22 2 2 2 2
𝑉𝑎𝑟(𝑋)=𝐸(𝑋−𝜇) =∑(𝑥−𝜇) 𝑓(𝑥)=∑(𝑥 −2𝜇𝑥+𝜇 )𝑓(𝑥)=∑𝑥 𝑓(𝑥)−2𝜇∑𝑥𝑓(𝑥)+¿𝜇 ∑𝑓(𝑥)=∑𝑥 𝑓(𝑥)−2𝜇 +𝜇 =∑𝑥 𝑓(𝑥)−𝜇 =𝐸(𝑋 )−𝜇 ¿
al 𝑥 al 𝑥 al 𝑥 al 𝑥 al 𝑥 al 𝑥 al 𝑥
Example 3.10: Mean and variance
2 2
𝑉𝑎𝑟
( 𝑋 )= 𝐸(𝑋 ¿ ¿ 2)− 𝜇 =15 −3 =6 ¿
(4) Binomial Distribution
The binomial distribution:
: a fixed number of independent Bernoulli trials
: the probability of success in each trial
# successes in trials
binomial random variable:
where = 0, 1, 2,
• is a probability distribution, because
1) and
• : a Bernoulli trial
• Binomial tables: Table A.2
If then
20
Example 3.13:
(1)
Using R, it can be obtained as
>pbinom(7, 12, 0.3)
(2)
Using R, it can be obtained as
>dbinom(7, 12, 0.3)
(3)
Using R, it can be obtained as
>1-pbinom(6, 12, 0.3)
(4)
Using R, it can be obtained as
>pbinom(7, 12, 0.3) – pbinom(3, 12, 0.3)
For ,
Example 3.14: If the probability is 0.1 that a certain device fails a comprehensive
safety test, what are the probabilities that among 15 of such devices,
(a) at most two will fail?
Example 3.15: Find the mean and variance of the probability distribution of
the number of heads obtained in three flips of a balanced coin.
Var()
Binomial distribution
: skewed to the right
: skewed to the left
: symmetric
23
(5) Hypergeometric Distribution
(Sampling w/o replacement)
1)Finite population with individuals (binomial: infinite pop.)
2) or . There are successes in the population.
3) Sample size: . Each subset of size is equally likely to be chosen.
𝑎 𝑁 −𝑎
𝑃 ( 𝑋=𝑥 )=
( )(
𝑥 𝑛−𝑥 )
( 𝑁𝑛 )
max { 0 , 𝑛− 𝑁 +𝑎 } ≤ 𝑥 ≤ min { 𝑛 , 𝑎 } ( ∵ 𝑥 ≤𝑎∧𝑛− 𝑥 ≤ 𝑁 −𝑎 )
Using R,
• Probability distribution:
>dhyper(x, a, N-a, n)
• cdf:
>phyper(x, a, N-a, n)
Example 3.17: A shipment of 25 CD’s contains 5 that are defective. If 10
of them are randomly chosen without replacement, what is the
probability that 2 of the 10 will be defective?
Using R,
>dhyper(2, 5, 20, 10)
Hypergeometric Distribution
x e
P ( X x) f ( x) , x 0,1,2, (e=2.71828)
x!
𝐸 ( 𝑋 ) =𝑉𝑎𝑟 ( 𝑋 )= 𝜆
Poisson Distribution
Maclaurin Series:
2 3 ∞ 𝑥
𝜆 𝜆 𝜆 𝜆
𝑒 =1+ 𝜆+ + + ⋯=∑
2! 3! 𝑥=0 𝑥 !
𝜆 𝑥 𝑒− 𝜆 − 𝜆 𝜆
∑ 𝑓 (𝑥 ¿)=∑ 𝑥!
=𝑒 𝑒 =1 ¿
For Poisson,
• Probability distribution:
>dpois(x, )
• cdf:
>ppois(x, )
Example 3.19: A 911 operator handles 4 calls every 3 hours
on average.
(a) What is the probability of no calls in the next hour?
>dpois(0,4/3)
(b) Find the probability of at most two calls in the next hour.
>ppois(2, 4/3)
Example 3.20:
On average, 12 cars pass a toll gate booth in a minute during rush hours.
>dpois(1, 0.6)
(b) Probability that at least two cars pass in 5 seconds:
>1-ppois(1, 1)
>ppois(1, 2)
Poisson approximation to the binomial
Let .
Let and such that remains constant ( is a moderate number).
Then
such that
acceptable
excellent approximation
Example 3.21: A publisher of mystery novels tries to keep its books
free of typos. The probability of any given page containing at least one
typo is 0.003 and errors are independent from page to page. What is the
approximate probability that a 500 page book has
(a) exactly 1 page with typos?
>dpois(1, 1.5)
>ppois(2, 1.5)
(7) Geometric Distribution
1.Each trial: Success (S) or Failure (F)
2. Independent trials
3.
4. Continues until the first success is observed
• Probability of getting the first success on the -th trial:
• Using R,
probability distribution
>dgeom(x-1, p)
cdf
>pgeom(x-1, p)
Example 3.23: A fair die is tossed until a certain number
appears. What is the probability that the first six appears at
the fifth toss?
Using R,
>dgeom(4, 1/6)
(8) Chebyshev’s Inequality
If a
probability distribution has mean and sd , the
probability of deviation from by at least is at
most .
Equivalently,
Example 3.24: The bearings made by a certain process have a mean radius of 18
mm with a standard deviation of 0.025 mm. With what minimum probability
can we assert that the radius of a bearing is between 17.9 mm and 18.1 mm?
At least 15/16
Example 3.25: What can you say about the probability that a random
variable falls within two standard deviations of its mean?
(9) Multinomial Distribution
Each trial results in any one of possible outcomes.
,
+
Example 3.26: Toss a drum 10 times.
2, 5, 3)