CPSC531 Probability
CPSC531 Probability
Carey Williamson
Department of Computer Science
University of Calgary
Fall 2017
Overview
Goals:
Review the fundamental concepts of probability
Understand the difference between discrete and
continuous random variable
Review the most common probability models
2
Outline
3
Outline
4
Probability
6
Probability of Events
7
Joint Probability
8
Independent Events
9
Mutually Exclusive Events
10
Union Probability
11
Conditional Probability
12
Random Variable
13
Random Variable
Possible outcomes
15
Random Variable
16
Types of Random Variables
Discrete
— Random variables whose set of possible values can be
written as a finite or infinite sequence
— Example: number of requests sent to a web server
Continuous
— Random variables that take a continuum of possible values
— Example: time between requests sent to a web server
17
Probability Mass Function (PMF)
Properties:
18
PMF Examples
0 1/8
1 3/8
2 3/8
3 1/8
19
Probability Density Function (PDF)
Properties:
—
20
Probability Density Function
, for
21
Cumulative Distribution Function (CDF)
— If is discrete, then
— If is continuous, then
Properties
— is a non-decreasing function, i.e., if , then
— , and
All probability questions about can be answered in terms of the CDF, e.g.:
for all
22
Cumulative Distribution Function
23
Cumulative Distribution Function
— The probability that the device lasts for less than 2 years:
24
Joint Probability Distribution
— Discrete:
— Continuous:
25
Expectation of a Random Variable
n
xi p ( xi ) discrete X
i 1
E[ X ]
xf ( x)dx continuous X
Example: number of heads in tossing three coins
E[X] = 0 p(0) + 1 p(1) + 2 p(2) + 3 p(3)
= 1 3/8 + 2 3/8 + 3 1/8
= 12/8
= 1.5 26
Expectation of a Function
27
Properties of Expectation
28
Misuses of Expectations
X E[ X ]
E
Y E[Y ] 29
Variance of a Random Variable
30
Variance of a Random Variable
( x ) 2 f ( x)dx continuous X
where, μ= E[X]
Equivalently:
σ2 = E[X2] – (E[X])2 31
Variance of a Random Variable
σ2 = (0 – 1.5)2p(0) + (1 – 1.5)2p(1)
+ (2 – 1.5)2p(2) + (3 – 1.5)2p(3)
= 9/4 1/8 + 1/4 3/8 + 1/4 3/8 + 9/4 1/8
= 24/32
= 3/4
32
Variance of a Random Variable
34
Coefficient of Variation
Coefficient of Variation:
3/ 4 1
CV
Example: inspection3 /device
2 3
E[ X ] 2
CV 1
2
35
Covariance
38
Outline
39
Outline
40
Discrete Uniform Distribution
PMF:
𝑝(𝑥𝑖)
1
4
1 2 3 4
41
Discrete Uniform Distribution
42
Bernoulli Trial
PMF:
Properties:
— and
43
Binomial Distribution
where,
Properties:
— and
44
Example: Binomial Distribution
CDF:
Properties:
, and
46
Example: Geometric Distribution
Examples
— The number of calls received by a switchboard per minute
— The number of packets coming to a router per second
— The number of travelers arriving to the airport for flight registration
per hour
48
Poisson Distribution
PMF: the probability that there are exactly events in a time interval
,
CDF: the probability of at least events in a time interval
Properties:
49
Example: Poisson Distribution
51
Outline
52
Uniform Distribution
— CDF:
Properties: CDF
, and
53
Uniform Distribution Properties
𝑓 (𝑥 )= {
1,0≤ 𝑥≤1
0 , otherwise
— Very useful for random number generation in simulations
54
Exponential Distribution
Properties:
, and
for
— The probability that the car repair time lasts between 2 to 3 hours is:
— The probability that the repair time lasts for another hour given that it has
already lasted for 2.5 hours:
Using the memoryless property of the exponential distribution,
58
Normal Distribution
59
Why Normal?
There are two main reasons for the popularity of the normal
distribution:
Properties:
62
Standard Normal Distribution
63
Normal Distribution
Two techniques:
1. Use numerical methods (no closed form)
2. Use the standard normal distribution
— is widely tabulated
— Use the transformation
— If then , i.e., standard normal distribution:
64
Normal Distribution
65
Stochastic Process
Stochastic Process:
Collection of random variables indexed over time
Example:
— N(t): number of jobs at the CPU of a computer system over
time
— Take several identical systems and observe N(t)
— The number N(t) at any time is a random variable
— Can find the probability distribution functions for N(t) at
each possible value of t
Notation:
66
Poisson Process
Counting Process:
A stochastic process that represents the total number of
events occurred in the time interval
Poisson Process:
The counting process is a Poisson process with rate , if:
67
Interarrival Times
Proof?
68
Splitting and Pooling
Pooling:
— : Poisson process with rate
— : Poisson process with rate
— : Poisson process with rate
N1(t) ~ Poisson(l1) l1
l 1 + l2
N(t) ~ Poisson(l1 + l2)
N2(t) ~ Poisson(l2) l2
Splitting:
— : Poisson process with rate
— Each event is classified as Type I, with probability and Type II, with probability
— : The number of type I events is a Poisson process with rate
— : The number of type II events is a Poisson process with rate
— Note:
lp N1(t) ~ Poisson(lp)
N(t) ~ Poisson(l) l
N2(t) ~ Poisson(l(1-p))
l(1-p) 69
More on Poisson Distribution
71
Empirical Distribution
72
Empirical Distribution
0.9
— Appropriate when a large 0.8
0.6
— Empirical CDF is approximated 0.5
0.3
the ‘jump points’ connected 0.2
Piecewise Linear
Empirical CDF
73
Empirical Distribution
•••
𝑎0 𝑎𝑖−1 𝑎 𝑖 𝑎𝐾
intervals
— Empirical CDF:
If is in interval , i.e., , then:
74
Example Empirical Distribution
Suppose the data collected for 100 broken machine repair times are:
Interval Relative Cumulative
i (Hours) Frequency Frequency Frequency Slope
1 0.0 < x ≤ 0.5 31 0.31 0.31 0.62
2 0.5 < x ≤ 1.0 10 0.10 0.41 0.2
3 1.0 < x ≤ 1.5 25 0.25 0.66 0.5
4 1.5 < x ≤ 2.0 34 0.34 1.00 0.68
0.6
0.5 Slope
0.4
0.3
0.2
0.1
0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
𝑎0 𝑎1 𝑎2 𝑎3 𝑎4
75