System Modeling and Simulation Carey Williamson Department of - - PowerPoint PPT Presentation
System Modeling and Simulation Carey Williamson Department of - - PowerPoint PPT Presentation
CPSC 531: System Modeling and Simulation Carey Williamson Department of Computer Science University of Calgary Fall 2017 Outline Probability and random variables Random experiment and random variable Probability mass/density
- Probability and random variables
—Random experiment and random variable —Probability mass/density functions —Expectation, variance, covariance, correlation
- Probability distributions
—Discrete probability distributions —Continuous probability distributions —Empirical probability distributions
Outline
2
- Random Experiment
3
- Probability of Events
4
- Joint Probability
5
- Independent Events
6
- Mutually Exclusive Events
7
- Union Probability
8
- Conditional Probability
9
- 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
Types of Random Variables
10
- Probability Density Function (PDF)
) ( ) ( x F dx d x f
11
- Cumulative Distribution Function (CDF)
12
- Expectation of a Random Variable
X dx x xf X x p x X E
n i i i
continuous ) ( discrete ) ( ] [
1
13
- Properties of Expectation
14
- Multiplying means to get the mean of a product
- Example: tossing three coins
—X: number of heads —Y: number of tails —E[X] = E[Y] = 3/2 E[X]E[Y] = 9/4 —E[XY] = 3/2
E[XY] ≠ E[X]E[Y]
- Dividing means to get the mean of a ratio
Misuses of Expectations
] [ ] [ Y E X E Y X E ] [ ] [ ] [ Y E X E XY E
15
- Variance of a Random Variable
16
- Variance: The expected value of the square of distance
between a random variable and its mean where, μ= E[X]
- Equivalently:
σ2 = E[X2] – (E[X])2
Variance of a Random Variable
X dx x f x X x p x X E X V
n i i i
continuous ) ( ) ( discrete ) ( ) ( ] ) [( ] [
2 1 2 2 2
17
- Properties of Variance
18
- Coefficient of Variation
3 1 2 / 3 4 / 3 CV
19
- Covariance
20
- Covariance
x y xy p(x) 3 1/8 1 2 2 3/8 2 1 2 3/8 3 1/8 xy p(xy) 2/8 2 6/8
21
- Correlation
- 1
+1 No correlation Positive linear correlation Negative linear correlation
22
- Autocorrelation
- 1
+1 No correlation Positive linear correlation Negative linear correlation
23
- Correlation (if desired) can be induced by sharing or re-using
random numbers between two (or more) random variables
- Example: height and weight of medical patients
- Example: a coin that remembers some of its recent history
Demo: Correlation and Autocorrelation
- 1
+1 No correlation Positive linear correlation Negative linear correlation
24
- Geometric Distribution
25
Example: Geometric Distribution
Geometric distribution PMF Geometric distribution CDF
- Uniform Distribution
CDF PDF
27
- Uniform Distribution Properties
28
- Exponential Distribution
29
Example: Exponential Distribution
Exponential distribution PDF Exponential distribution CDF
- Scenario: Walmart has a giant bin of lightbulbs on sale. You
buy one and bring it home for testing and observation.
- Assume: All light bulbs last exactly 100 hours.
- Observation: Your light bulb has worked for 70 hours.
- Question: How much longer is it expected to last?
- Answer:
Light Bulb Testing (1 of 5)
31
30 hours
- Scenario: Walmart has a giant bin of lightbulbs on sale. You
buy one and bring it home for testing and observation.
- Assume: Half of the light bulbs last exactly 50 hours, while the
- ther half last exactly 150 hours. The mean is 100 hours.
- Observation: Your light bulb has worked for 70 hours.
- Question: How much longer is it expected to last?
- Answer:
Light Bulb Testing (2 of 5)
32
80 hours
- Scenario: Walmart has a giant bin of lightbulbs on sale. You
buy one and bring it home for testing and observation.
- Assume: Half of the light bulbs last exactly 50 hours, while the
- ther half last exactly 150 hours. The mean is 100 hours.
- Observation: Your light bulb has worked for 40 hours.
- Question: How much longer is it expected to last?
- Answer:
Light Bulb Testing (3 of 5)
33
60 hours
- Scenario: Walmart has a giant bin of lightbulbs on sale. You
buy one and bring it home for testing and observation.
- Assume: Light bulbs have a working duration that is uniformly
distributed (continuous) between 50 hours and 150 hours. The mean is 100 hours.
- Observation: Your light bulb has worked for 70 hours.
- Question: How much longer is it expected to last?
- Answer:
Light Bulb Testing (4 of 5)
34
40 hours
- Scenario: Walmart has a giant bin of lightbulbs on sale. You
buy one and bring it home for testing and observation.
- Assume: Light bulbs have a working duration that is
exponentially distributed with a mean of 100 hours.
- Observation: Your light bulb has worked for 70 hours.
- Question: How much longer is it expected to last?
- Answer:
Light Bulb Testing (5 of 5)
35
100 hours
- Memoryless Property
36
Example: Exponential Distribution
- 37