Notes Chapter4 ContinuousRandomVariables
Notes Chapter4 ContinuousRandomVariables
Chaoyue Liu
Department of Mathematics and Statistics
1
Outline
• Continuous Random Variables
• PDFs and CDFs of Continuous Random Variables
• Expected Value and Variance of Continuous Random
Variables
• Uniform Distribution
• Exponential Distribution
2
Introduction to Continuous Random
Variables
Chaoyue Liu
Department of Mathematics and Statistics
3
Outline
• Introduction to Continuous Random Variables
• Probability Density Function (pdf)
• Cumulative Distribution Function (cdf)
• Expected Values and Variance
4
Continuous Random Variables
• Discrete Random Variables: countable values
• Continuous Random Variables: uncountable values
5
Probability Density Function (pdf)
• Discrete: probability mass function (pmf)
• Continuous: probability density function (pdf)
• Let X be a continuous random variable. The probability density function (pdf) of X is a real valued function f (x) that
satisfies
∫a
For any two real numbers a ≤ b ∈ ℝ, P(a ≤ X ≤ b) = f (x)dx
-
∫−∞
-
f (x)dx = 1
Example:
6
Probability Density Function (pdf)
• pdf f(x) is not a probability
• The probability for a continuous random variable is given by areas under pdf,
b
∫a
P(a ≤ X ≤ b) = f(x)dx
∫a
P(a ≤ X ≤ b) = P(a < X < b) = P(a ≤ X < b) = P(a < X ≤ b) = f(x)dx
7
Cumulative Distribution Function
• Let X have pdf f(x), then the cdf F(x) is given by
x
∫−∞
F(x) = P(X ≤ x) = f(t)dt, for x ∈ℝ
- For x ∈ ℝ, F(x) is the area under the density curve to the left of x.
- F(X) is non-decreasing
• Example:
pdf cdf
8
Relationship between PDF and CDF for
Continuous Random Variables
• cdf can be found by integrating the pdf:
x
∫−∞
F(x) = f(t)dt
∫a
Compute probability: P(a ≤ X ≤ b) = f(x)dx = F(b) − F(a)
•
9
Example (pdf -> cdf)
• Given the pdf of X as below,
{ 0,
kx 2, 0 ≤ x ≤ 2
f(x) =
otherwise
10
Example (cdf -> pdf)
• Let X be a random variable with a cdf:
0, x≤0
[ ]
1 + ln ( x ) , 0 < x ≤ 4
x 4
F(x) = 4
1, 4<x
Find:
- (1) P(X ≤ 1)
- (2) P(1 ≤ X ≤ 3)
- (3) the pdf of X
11
Percentiles
• A percentile is a value below which a percentage of data falls. e.g. A
student’s test score is at the 85th percentile of the class means that 85% students
scores are lower than that score and 15% are above.
∫−∞
p = P(X ≤ η(p)) = F(η(p)) = f(u)du
• Special cases:
12
Example
• Let X be a continuous rv with the following pdf:
f(x) = 2x, 0 ≤ x ≤ 1
- Find
13
Expected Value and Variance of
Continuous Random Variables
• The expected value or mean of a continuous rv X with pdf f(x) is
∞
∫−∞
μ = E(X ) = xf(x)dx
∫−∞
μh(X) = E(h(X )) = h(u)f(u)du
• The variance of X is
∞
∫−∞
V(X ) = σX2 = σ 2 = E [(X − μ)2] = (x − μ)2 f(x)dx
• Linear function of X:
14
Example
• Let X be a random variable with the following pdf
1
{0
x ∈ [0,1] ∪ [2,3]
f(x) = 2
•
otherwise
15
Discrete vs Continuous
∑ ∫A
P{X ∈ A} = p(x) P{X ∈ A} = f(x)dx
x∈A
x
∑ ∫−∞
F(x) = P{X ≤ x} = p(y) F(x) = P{X ≤ x} = f(y)dy
y≤x
∞
∑ ∫−∞
p(x) = 1 f(x)dx = 1
x
∞
∑
∫−∞
E(X ) = xp(x) E(X) = xf(x)dx
x
∞
∫−∞
(x − μ)2 p(x) V(X) = (x − μ)2 f(x)dx
∑
V(X) =
x
16
Uniform Distribution and Exponential
Distribution
Chaoyue Liu
Department of Mathematics and Statistics
17
Outline
• Uniform Distribution
• Exponential Distribution
18
Uniform Distribution
• A continuous random variable X is said to have a uniform distribution on the
interval [a, b], denoted by X ∼ uniform(a, b), if its pdf is
1
{ 0,
, a≤x≤b
f(x; a, b) = b−a
otherwise
b+a
- Mean: E(X) =
2
(b − a)2
- Variance: V(X) =
12
- The uniform distribution assigns equal probabilities to intervals of equal lengths
19
Exercise
• Check that f(x) for Uniform Distribution is a legitimate pdf.
20
Exponential Distribution
• A random variable X follows an exponential distribution with (scale)
parameter λ > 0 , denoted by X ∼ Exp(λ), if the pdf of X is
{ 0
−λx
f(x) = λe x≥0
• otherwise
• If the number of Independent events occurring follows a Poisson distribution with rate
λ, then the distribution of waiting time between two consecutive events follows
exponential distribution with same parameter λ.
21
Properties of Exponential Distribution
• If X ∼ Exp(λ), then
1
- Mean: E(X) =
λ
1
- Variance: V(X) = 2
λ
{1 − e −λx x ≥ 0
0 x<0
cdf of X: F(x) =
-
- Memoryless Property, i.e. P(X > t + s | X > s) = P(X > t), for any
t, s ≥ 0. i.e. It "forgets" the time already spent.
22
Example
• Assume that buses arrive at a bus stop with rate α = 4 buses/hour. You
get off a bus and wait for the next bus to arrive.
- (1) What is the probability you wait between 15 to 30 minutes?
- (2) What is the 40th percentile of your waiting time
- (3) What is your expected waiting time?
23
Normal Distribution, Standardization
and Z-table
Chaoyue Liu
Department of Mathematics and Statistics
24
Outline
• Normal Distribution
• Standardization
• Z-table
25
Normal Distribution
• Normal distribution, also known as Gaussian distribution, is very important in
statistics, because it occurs naturally in many situations. e.g. height of the
population, IQ, measurement error…
26
Normal Distribution
• X follows a normal distribution with mean μ and variance σ 2 denoted by X ∼ N(μ, σ 2), if the pdf of
X is
1 − (x − μ)
2
f(x) = e 2σ 2 , −∞<x<∞
2πσ
• N(μ, σ 2) is symmetric at μ
• Mean: E(X ) = μ, is a location parameter.
• Variance: V(X ) = σ 2, is a shape parameter. The larger the σ, the more the spread.
27
Standard Normal Distribution
• The normal distribution with μ = 0 and σ = 1 is called a standard normal
distribution.
2 X−μ
• If X ∼ N(μ, σ ), then the random variable Z = will follow the standard
σ
normal distribution Z ∼ N(0,1). Z is usually called Z value or Z score.
e.g.
P(Z ≥ z0.05) = 0.05 ⟺ P(Z ≤ z0.05) = 1 − 0.05 = 0.95
28
Standardization
• Standardization:
2 X−μ
If X ∼ N(μ, σ ), then the random variable Z = ∼ N(0,1) , and the probability
σ
of X can be computed as
( σ σ )
a−μ b−μ
P(a ≤ X ≤ b) = P ≤Z≤
( σ ) ( σ )
b−μ a−μ
=Φ −Φ
29
Z table
• Z tables are composed as follows:
1. The row label contains the integer part and the first decimal place of
Z.
2. The column lable contains the second decimal place of Z
3. The values within the table are the probabilities
Example:
30
Examples
• given z value, find probability
31
Examples
• Some useful rules for Z ∼ N(0,1)
- P(Z > a) = 1 − Φ(a) - P( | Z | > a) = 2Φ(−a), a > 0
- P(a < Z < b) = Φ(b) − Φ(a) - P( | Z | < a) = 2Φ(a) − 1,a > 0
• note that:
- | Z | ≥ a ⟺ Z ≤ − a or Z ≥ a - |Z| ≤ a ⟺ − a ≤ Z ≤ a
( σ σ )
a−μ b−μ
P(a ≤ X ≤ b) = P ≤Z≤
then
( σ ) ( σ )
- b−μ a−μ
=Φ −Φ
32
Exercise
• Let Z be a standard normal random variable,
- 1) calculate P( | Z − 1 | ≤ 1.5)?
33
Exercise
• Let X be the IQ of a randomly selected person. Assume X ∼ N(100,256). What is
the probability that a randomly selected person has an IQ
- above 140?
34
Normal Approximation to the Binomial
Distribution
• If X
∼ Bin(n, p) with np ≥ 10 and n(1 − p) ≥ 10, then X has
approximately a normal distribution N(np, np(1 − p)),
( np(1 − p) )
x + 0.5 − np
P(X ≤ x) ≈ Φ
The term 0.5 is added as a correction term for using a continuous distribution to
approximate a discrete distribution
• Comparison:
- Poisson approximation to binomial: n is large and p is small. n > 50 and np < 5
- Normal approximation to binomial: not too skewed (enough symmetry). np ≥ 10
and n(1 − p) ≥ 10.
35
Exercise
• At a particular college, the pass rate of a course is 72%. If 500
students enroll in a semester, what is the probability that at most
375 students pass?
36