PSTAT 5A: Continuous Random Variables

Lecture 9

Narjes Mathlouthi

2025-07-29

Welcome to Lecture 9

Continuous Random Variables

From discrete jumps to smooth curves: modeling the continuous world

Today’s Learning Objectives

By the end of this lecture, you will be able to:

  • Distinguish between discrete and continuous random variables (Section 3)
  • Understand probability density functions (PDFs) and their interpretation (Section 4)
  • Work with cumulative distribution functions (CDFs) for continuous variables
  • Calculate probabilities using areas under curves
  • Compute expected values and variances for continuous distributions
  • Work with common continuous distributions (Uniform, Normal, Exponential)
  • Apply the Central Limit Theorem
  • Use python to work with continuous distributions

Review: Discrete vs Continuous

Discrete Random Variables

  • Countable values (can list them)
  • Gaps between possible values
  • Uses Probability Mass Function (PMF)
  • P(X = x) makes sense

Examples: Dice rolls, number of emails, quiz scores

Continuous Random Variables

  • Uncountable values (infinite possibilities)
  • No gaps - any value in an interval
  • Uses Probability Density Function (PDF)
  • P(X = x) = 0 for any specific value!

Examples: Height, weight, time, temperature

Why P(X = x) = 0 for Continuous Variables?

For continuous random variables, the probability of any exact value is zero!

Think about it: What’s the probability someone is exactly 5.7324681… feet tall?

Instead, we ask:

  • P(5.7 ≤ X ≤ 5.8)?

  • P(X ≤ 6.0)?

  • P(X > 5.5)?

Key insight: We calculate probabilities for intervals, not exact points.

Click to see why P(X = exact value) = 0

Probability Density Function (PDF)

🎯 Definition: The Probability Density Function (PDF) of a continuous random variable X is a function f(x) such that:

P(a \leq X \leq b) = \int_a^b f(x) \, dx

Properties of PDF:

  • f(x) \geq 0 for all x
  • \int_{-\infty}^{\infty} f(x) \, dx = 1
  • f(x) is NOT a probability - it’s a density!

Key Insight:

The area under the PDF curve between a and b gives the probability that X falls in that interval.

Interactive PDF Demo: Understanding Density

Probability = Area under curve: Select an interval to see probability

Cumulative Distribution Function (CDF)

For continuous random variables, the CDF is:

F(x) = P(X \leq x) = \int_{-\infty}^x f(t) \, dt

Key relationship: f(x) = \frac{d}{dx}F(x)

The PDF is the derivative of the CDF!

Click anywhere to see F(x) = P(X ≤ x) for that point

Expected Value and Variance

Expected Value: E[X] = \mu = \int_{-\infty}^{\infty} x \cdot f(x) \, dx

Variance:

\text{Var}(X) = \sigma^2 = \int_{-\infty}^{\infty} (x - \mu)^2 f(x) \, dx = E[X^2] - (E[X])^2

Where:

E[X^2] = \int_{-\infty}^{\infty} x^2 \cdot f(x) \, dx

Important

Notice: Integrals replace sums when moving from discrete to continuous!

Common Continuous Distributions

Uniform Distribution

All values equally likely in an interval

Parameters: a (min), b (max)

PDF: f(x) = \frac{1}{b-a} for a \leq x \leq b

Mean: \frac{a+b}{2}

Variance: \frac{(b-a)^2}{12}

Use: Random numbers, waiting times

Normal Distribution

Bell-shaped, symmetric

Parameters: \mu (mean), \sigma^2 (variance)

PDF: f(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}}

Mean: \mu

Variance: \sigma^2

Use: Heights, test scores, errors

Exponential Distribution

Models waiting times

Parameters: \lambda (rate)

PDF: f(x) = \lambda e^{-\lambda x} for x \geq 0

Mean: \frac{1}{\lambda}

Variance: \frac{1}{\lambda^2}

Use: Time between events, lifetimes

The Normal Distribution

Why Normal is Special

  • Central Limit Theorem: Sample means approach normal
  • 68-95-99.7 Rule:
    • 68% within 1 \sigma of \mu
    • 95% within 2 \sigma of \mu
    • 99.7% within 3 \sigma of \mu
  • Standard Normal: \mu = 0 , \sigma = 1

Z-Score Transformation

Z = \frac{X - \mu}{\sigma}

Practice Problem 1: Uniform Distribution

A bus arrives uniformly between 10:00 AM and 10:20 AM. Let X = arrival time in minutes after 10:00 AM.

(a) What is the PDF of X?
(b) What’s the probability the bus arrives between 10:05 and 10:12?
(c) What’s the expected arrival time?

Solution. (a) X \sim \text{Uniform}(0, 20) f(x) = \frac{1}{20-0} = \frac{1}{20} \text{ for } 0 \leq x \leq 20

(b) P(5 \leq X \leq 12) = \int_5^{12} \frac{1}{20} dx = \frac{1}{20} \times (12-5) = \frac{7}{20} = 0.35

(c) E[X] = \frac{a+b}{2} = \frac{0+20}{2} = 10 minutes after 10:00 AM

Practice Problem 2: Normal Distribution

Heights of adult women are normally distributed with μ = 64 inches and σ = 2.5 inches.

(a) What’s the probability a woman is taller than 67 inches?
(b) What height represents the 90th percentile?
(c) What’s the probability a woman is between 62 and 66 inches tall?

Solution. (a) P(X > 67) = P\left(Z > \frac{67-64}{2.5}\right) = P(Z > 1.2) = 1 - 0.8849 = 0.1151

(b) For 90th percentile: P(X \leq x) = 0.90
z_{0.90} = 1.28, so x = 64 + 1.28(2.5) = 67.2 inches

(c) P(62 \leq X \leq 66) = P\left(\frac{62-64}{2.5} \leq Z \leq \frac{66-64}{2.5}\right)
= P(-0.8 \leq Z \leq 0.8) = 0.7881 - 0.2119 = 0.5762

Practice Problem 3: Exponential Distribution

The time between customer arrivals at a store follows an exponential distribution with an average of 5 minutes between arrivals.

(a) What is the PDF?
(b) What’s the probability the next customer arrives within 3 minutes?
(c) What’s the probability no customer arrives in the next 10 minutes?

Solution. (a) Average = 5 minutes = \frac{1}{\lambda}, so \lambda = 0.2
f(x) = 0.2e^{-0.2x} \text{ for } x \geq 0

(b) P(X \leq 3) = \int_0^3 0.2e^{-0.2x} dx = 1 - e^{-0.2 \times 3} = 1 - e^{-0.6} = 0.4512

(c) P(X > 10) = e^{-0.2 \times 10} = e^{-2} = 0.1353

Central Limit Theorem

Interactive CLT Demo: Sample Means Approach Normal

Population Distribution
Sample Means Distribution

CLT in Action: Run simulation to see the magic!

Transformations of Random Variables

Linear Transformations

If Y = aX + b, then:

  • E[Y] = aE[X] + b
  • \text{Var}(Y) = a^2\text{Var}(X)
  • If X \sim N(\mu, \sigma^2), then Y \sim N(a\mu + b, a^2\sigma^2)

Standardization

Z = \frac{X - \mu}{\sigma} \sim N(0, 1)

Important: Normal distributions are closed under linear transformations!

Comparing Discrete and Continuous

Property Discrete Continuous
Probability Function PMF: P(X = x) PDF: f(x)
Exact Value Probability P(X = x) > 0 possible P(X = x) = 0 always
Interval Probability \sum P(X = x_i) \int_a^b f(x) dx
Expected Value \sum x \cdot P(X = x) \int x \cdot f(x) dx
Variance \sum (x-\mu)^2 P(X = x) \int (x-\mu)^2 f(x) dx
CDF \sum_{x_i \leq x} P(X = x_i) \int_{-\infty}^x f(t) dt

Properties of Continuous Distributions

Key Properties

  1. Memoryless Property (Exponential only):
    P(X > s+t | X > s) = P(X > t)

  2. Symmetry (Normal):
    P(X \leq \mu - a) = P(X \geq \mu + a)

  3. Scaling Invariance (Normal):
    Linear combinations of normals are normal

Useful Relationships

  • CDF to PDF: f(x) = F'(x)
  • PDF to CDF: F(x) = \int_{-\infty}^x f(t) dt
  • Complementary CDF: P(X > x) = 1 - F(x)

Remember: Area under PDF = 1, but PDF values can exceed 1!

Key Takeaways

Main Concepts

  • Continuous variables require PDFs, not PMFs
  • Probabilities are areas under curves, not function values
  • Integration replaces summation for continuous distributions
  • Normal distribution is central due to CLT

Distribution Selection

Choose distributions based on the data characteristics:

  • Uniform for equally likely intervals
  • Normal for symmetric, bell-shaped data
  • Exponential for waiting times/lifetimes
  • Use CLT when working with sample means

Key Principle

  • Central Limit Theorem makes normal distributions ubiquitous in statistics

Looking Ahead

Next Lecture: Statistical Inference

Topics we’ll cover:

  • Sampling distributions
  • Confidence intervals
  • Hypothesis testing
  • p-values and significance

Connection: Continuous distributions (especially normal) form the foundation for statistical inference

Questions?

Office Hours: 11AM on Thursday (link on Canvas)

Email: nmathlouthi@ucsb.edu

Next Class: Statistical Inference and Hypothesis Testing

Resources

Back to Main Page

🏠 Back to Main Page