Probability
Probability
By
20 April 2021
Probability
Probability
Probability: is a measure of the likelihood of a
random phenomenon or chance behavior.
Probability describes the long-term proportion
with which a certain outcome will occur in
situations with short-term uncertainty.
EXAMPLE
Simulate flipping a coin 100 times. Plot the
proportion of heads against the number of flips.
Repeat the simulation.
3
Probability
• Life is uncertain and full of surprise. Do you know what happen
tomorrow
• Make decision and live with the consequence
• The probability of an event is a numerical value that measures the
likelihood that the event can occur
Probability as a Numerical Measure
of the Likelihood of Occurrence
0 .5 1
Probability:
0 ≤P(E)≤ 1
The sum of the probability of all possible outcomes should be 1.
•Examples:
–Toss a fair coin. P(Head) = 1/2
–Rolling a two pair of fair dice
P(4) = 2/12=1/6
Example: Suppose that a pair of fair dice are thrown.
suppose a pair of fair 6-sided dice are thrown. what is the probability that the
sum of the rolls is 6?
Solution
8
Example
The first two are discrete and the last four are continuous.
Binomial Distributions
Consider the following scenarios:
• The number of heads/tails in a sequence of coin flips.
• Vote counts for two different candidates in an election.
• The number of male/female employees in a company.
• The number of defective products in a production run
• The number of days in a month your company’s computer network
experiences a problem
All of these are situations where the binomial distribution may be
applicable.
Binomial Distributions
There is a set of assumptions which, if valid, would lead to a binomial
distribution. These are:
• A set of n experiments or trials are conducted.
• Each trial could result in either a success or a failure.
• The probability P of success is the same for all trials.
• The outcomes of different trials are independent.
• We are interested in the total number of successes in these n trials.
Binomial Distributions
Consider an experiment having only two possible outcomes. A and B, which are
mutually exclusive. Let the Probability be P(A)=p and P(B)= 1-p = q.
The experiment is repeated n times and the probability of A occurring i times is:
𝑛
𝑃𝑖 = 𝑖
𝑝𝑖 (1 − 𝑝)𝑛−𝑖 (1)
𝑛
where 𝑖
is the binomial coefficient,
𝑛 𝑛!
𝑖
= (2)
𝑖! 𝑛−𝑖 !
Binomial Mean and Variance
𝑚𝑒𝑎𝑛 𝜇 = 𝑛𝑝 (3)
Answers
Suppose a student is to select the answer for every question randomly. Let i be the number of questions the student answers
𝑛 𝑖 𝑛 𝑛! 𝑛!
𝑃𝑖 = 𝑝 (1 − 𝑝)𝑛−𝑖 , = 𝑃𝑖 = 𝑝𝑖 (1 − 𝑝)𝑛−𝑖
𝑖 𝑖 𝑖! 𝑛 − 𝑖 ! 𝑖! 𝑛 − 𝑖 !
10!
𝑃𝑖=0 = 0! (0.25)0 (1 − 0.25)10−0 = (0.75)10 = 0.0563
10−0 !
2-
𝑛 𝑖 𝑛 𝑛!
𝑃𝑖 = 𝑝 (1 − 𝑝)𝑛−𝑖 , =
𝑖 𝑖 𝑖! 𝑛 − 𝑖 !
𝑛!
𝑃𝑖 = 𝑝𝑖 (1 − 𝑝)𝑛−𝑖
𝑖! 𝑛 − 𝑖 !
10!
𝑃𝑖=2 = (0.25)2 (1 − 0.25)10−2
2! 10 − 2 !
= 0.0563+0.1877+0.2816+0.2503+0.1460+0.0584 =0.9803
4- 𝜇 = 𝑛𝑝 , 𝜇 = 10 × 0.25 = 2.5
Example: Three honest dice are rolled. Write the BPDF for the number of ones showing up.
Solution: Let X be the number of ones ; then p= 1/6 , (1-p) =5/6 , n =3, and
3
3 1 𝑖 5 3−𝑖
𝑝 𝑥 = ( )( ) 𝛿 𝑥−𝑖 ,
𝑖 6 6
𝑖=0
125 75 15 1
𝑝 𝑥 = 𝛿 𝑥 + 𝛿 𝑥−1 + 𝛿 𝑥−2 + 𝛿(𝑥 − 3)
216 216 216 216
Poisson distributions
When the number of trails n gets very large and p is very small, the binomial distribution becomes awkward to
handle. However, if the mean value remains finite we can approximate the binomial distribution by the Poisson
distribution,
𝜇𝑖
𝑃𝑖 = 𝑒 −𝜇 6
𝑖!
where µ is the average value of the occurrence of the desired event.
The Poison distribution is pertinent to the transmission of many data digits when the error rates are low. It also
arises in some physical problems.
0.30
0.25
0.20
0.15
0.10
0.05
0.00
1 2 3 4 5 6 7 8 9
Poisson distributions
Example: Typos
The number of typographical errors in a “big” textbook is Poisson distributed with a mean of 1.5 per 100 pages.
1-Suppose 100 pages of the book are randomly selected. What is the probability that there are no typos?
2-Suppose 400 pages of the book are randomly selected. What are the probabilities for having no typos and the probabilities for
having five or fewer typos?
Solution 𝜇𝑖
𝑃𝑖 = 𝑒 −𝜇
1.5
1- 𝜇 = 𝑛𝑝 = 100 × 100 = 1.5 𝑖!
(1.5)0
𝑃𝑖=0 = 𝑒 −1.5 = 0.2231
0!
1.5
2- 𝜇 = 𝑛𝑝 = 400 × 100 = 4 × 1.5 = 6
−6
(6)0
𝑃𝑖=0 = 𝑒 = 0.002479
0!
5 −𝜇 𝜇𝑖
3-𝑃 i ≤ 5 = 𝑖=0 𝑒 = 0.0025+0.0149+0.0446+0.0892+0.1339+0.1606=0.4457
𝑖!
Hw1:
Two honest dice are rolled and the desired outcome is the appearance of all ones. (a) Calculate the probability that this will
occur twice in forty rolls, first using the binomial distribution and then approximating with the Poisson distribution. (b) Repeat
Uniform distributions
The uniform distribution is the simplest example of a continuous probability
distribution. A random variable X is said to be uniformly distributed if its density
function is given by:
Normal distributions
A known probability density function (pdf) is the Gaussian or “normal” density function. It
arises when a large number of independent factors (within some fairly broad restrictions)
contribute additively to an end result. The normal distribution is the most important distribution
in statistics, since it arises naturally in numerous applications. The key reason is that large sums
of (small) random variables often turn out to be normally distributed.
A random variable X is said to have the normal distribution with parameters μ and σ if its
density function is given by:
1 1 𝑥−𝜇
− 2 ( 𝜎 )2
𝑓 𝑥 = 𝑒 7
𝜎 2𝜋
for −∞ ≤ 𝑥 ≤ ∞
(𝑥−𝜇)2 𝑥
where σ standard deviation 𝜎 = , µ is the mean 𝜇= , x each value in the
𝑁 𝑁
population, and N the number of values (population).
Normal distributions
A typical normal density curve looks like this:
Thus, the curve is bell shaped and is symmetric around the mean μ. The standard
deviation σ controls the “flatness” of the curve.
Example: Calculate the probability density function of normal distribution using the following data. x = 3, μ = 2
and σ = 2.
Solution: Given, variable, x = 3
Mean = 2 and
Standard deviation = 2
By the formula of the probability density of normal distribution, we can write;
Example: If the value of random variable is 2, mean is 2 and the standard deviation is 4, then find the
probability density function of the Gaussian distribution.
Solution: Given, Variable, x = 2
Mean = 2 and
Standard deviation = 4
By the formula of the probability density of normal distribution, we can write;
f(2,2,4) = 1/(4√2π) e0
f(2,2,4) = 0.0997
• Increasing the mean shifts the density curve to the right.
Same standard deviations, different means.
• Increasing the standard deviation flattens the density curve
Same mean, different standard deviations.
A normal distribution whose mean is 0 and standard deviation is 1 is called a normalized
Gaussian pdf. In this case, the density function assumes the simpler form:
1 −𝑧 2 2
𝑝 𝑧 = 𝑒 (8)
2𝜋
where a standardized normal random variable Z with parameters 0 and 1 via the transformation:
𝑥−𝜇
𝑍=
𝜎
The cumulative distribution function (CDF) calculates
the cumulative probability for a given x-value.
In case of a continuous distribution, it gives the area
under the probability density function from minus
infinity (-∞) to x.
You can also use this information to determine the
probability that an observation will be greater than a
certain value, or between two values.
Cumulative Distribution Function (CDF)
The exact value is the one given by the cumulative function.
dx
1
0.9
Benchmark
Measured
0.8
0.7
0.6
CDF
0.5
0.4
0.3
0.2
0.1
0
8 13 18 23 28 33 38
Speed (km/h)
Negative Exponential Distribution
Another useful continuous distribution is the exponential distribution, which has the following
probability density function:
𝑓 𝑥 = 𝜆𝑒 −𝜆𝑥 (9)
for x ≥ 0.
• This family of distributions is characterized by a single
parameter λ, which is called the rate.
• The exponential distribution is typically used to model time
intervals between “random events”.
Example: For = 0.5, 1, and 2, the shapes of the exponential
density curve are:
Observe that the greater the rate, the faster
the curve drops. Or, the lower the rate, the flatter the curve.