<<

ECE 302: Lecture 4.4 , Mode, and

Prof Stanley Chan

School of Electrical and Computer Engineering Purdue University

c Stanley Chan 2020. All Rights Reserved. 1 / 16 Median

Given a sequence of n 1 2 3 4 5 6 7 8 9 . . . 100 xn 1.5 2.5 3.1 1.1 -0.4 -4.1 0.5 2.2 -3.4 . . . -1.4

Find the median. Step 1: You sort the sequence Step 2: You pick the one in the middle

If we have a , what is the ideal median?

c Stanley Chan 2020. All Rights Reserved. 2 / 16 Median from PMF

Definition

Let X be a continuous random variable with PDF fX . The median of X is a point c ∈ R such that Z c Z ∞ fX (x)dx = fX (x)dx. (1) −∞ c

c Stanley Chan 2020. All Rights Reserved. 3 / 16 Median from CDF

Theorem The median of a random variable X is the point c such that 1 F (c) = . (2) X 2

Proof. R x 0 0 Since FX (x) = −∞ fX (x )dx , we have Z c Z ∞ FX (c) = fX (x)dx = fX (x)dx = 1 − FX (c). −∞ c

1 Rearranging the terms shows that FX (c) = 2 .

c Stanley Chan 2020. All Rights Reserved. 4 / 16 Example

Example 1. (Uniform random variable) Let X be a continuous random variable with 1 PDF: fX (x) = b−a for a ≤ x ≤ b, and is 0 otherwise. x−a CDF: FX (x) = b−a for a ≤ x ≤ b. Find median.

Solution: Want FX (c) = 1/2.

a + b c = 2

c Stanley Chan 2020. All Rights Reserved. 5 / 16 Example

Example 2. (Exponential random variable) Let X be a continuous random variable with −λx PDF: fX (x) = λe for x ≥ 0 −λx CDF: FX (x) = 1 − e for x ≥ 0 Find median.

Solution: Want FX (c) = 1/2.

c = (log 2)/λ

c Stanley Chan 2020. All Rights Reserved. 6 / 16 Mode

Given a sequence of numbers

n 1 2 3 4 5 6 7 8 9 . . . 100 xn 50 50 30 10 -40 -10 50 20 -30 . . . -1

How to find the mode? Step 1: Sort the sequence Step 2: Pick the that occurs most often?

What is the ideal mode?

c Stanley Chan 2020. All Rights Reserved. 7 / 16 Mode from PDF and CDF

Definition Let X be a continuous random variable. The mode is the point c such that fX (x) attains the maximum: d c = argmax fX (x) = argmax FX (x). (3) x∈Ω x∈Ω dx

c Stanley Chan 2020. All Rights Reserved. 8 / 16 Example

Example 1. Let X be a continuous random variable with

PDF fX (x) = 6x(1 − x) for 0 ≤ x ≤ 1. Find mode.

Solution. The mode of X happens at argmax fX (x). x

1 x = 2

c Stanley Chan 2020. All Rights Reserved. 9 / 16 Mean

Given a sequence of numbers n 1 2 3 4 5 6 7 8 9 . . . 100 xn 1.5 2.5 3.1 1.1 -0.4 -4.1 0.5 2.2 -3.4 . . . -1.4

Find the mean. N 1 X X = X . N n n=1

How to find mean from CDF?

c Stanley Chan 2020. All Rights Reserved. 10 / 16 Mean from CDF: Positive Case

Lemma

Let X > 0. Then, E[X ] can be computed from FX as Z ∞ E[X ] = (1 − FX (t)) dt. (4) 0 Proof: Z ∞ Z ∞ Z ∞ (1 − FX (t)) dt = [1 − P[X ≤ t]] dt = P[X > t]dt 0 0 0 ∞ ∞ ∞ x Z Z (a) Z Z = fX (x)dxdt = fX (x)dtdx 0 t 0 0 Z ∞ Z x Z ∞ = dtfX (x)dx = xfX (x)dx = E[X ]. 0 0 0

c Stanley Chan 2020. All Rights Reserved. 11 / 16 Interchange the integrations

Figure: A double integration can be evaluated in two ways: x then t, or t then x.

c Stanley Chan 2020. All Rights Reserved. 12 / 16 Negative Case

Lemma

Let X < 0. Then, E[X ] can be computed from FX as Z 0 E[X ] = FX (t)dt. (5) −∞

Proof. Z 0 Z 0 FX (t)dt = P[X ≤ t]dt −∞ −∞ Z 0 Z t = fX (x)dxdt −∞ −∞ Z 0 Z 0 Z 0 = fX (x)dtdx = xfX (x)dx = E[X ].  −∞ x −∞

c Stanley Chan 2020. All Rights Reserved. 13 / 16 The overall result

Theorem The mean of a random variable X can be computed from the CDF as

Z ∞ Z 0 E[X ] = (1 − FX (t)) dt − FX (t)dt. (6) 0 −∞

Proof. Let X = X + − X −. Then,

+ − E[X ] = E[X − X ] + − = E[X ] − E[X ] Z ∞ Z 0 = (1 − FX (t)) dt − FX (t)dt.  0 −∞

c Stanley Chan 2020. All Rights Reserved. 14 / 16 Summary

We have learned three things:

Median

50% of the area, from left and from right.

Mode

Peak of PDF, steepest slope of CDF

Mean R ∞ PDF: 0 tfX (t)dt, for X > 0 R ∞ CDF: 0 (1 − FX (t)) dt, for X > 0

c Stanley Chan 2020. All Rights Reserved. 15 / 16 Questions?

c Stanley Chan 2020. All Rights Reserved. 16 / 16