The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal...

25
The Normal Distribution

Transcript of The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal...

Page 1: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Normal Distribution

Page 2: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Normal Distribution

Page 3: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Administriviao Homework 3 due Friday. Good Milestones:

o Problems 1, 2, and 3 done last week

o Problems 4 and 5 done this week

o Midterm coming up in-class on Wednesday October 18th

o Mix of Multiple Choice and Free-Response Questions

o Allowed one 8.5 x 11in sheet of handwritten notes (no magnifying glasses)

o Allowed a calculator that can’t connect to internet or store large large data

Page 4: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Previously on CSCI 3022Def: A random variable X is continuous if for some function and for any numbers

and with

The function has to satisfy for all x and . We call the probability density function of X.

f : R ! Ra b a b

f(x) � 0R1�1 f(x) dx = 1 f

P (a X b) =

Z b

af(x) dx

f

Def: The cumulative distribution function of X is defined such that

F (x) = P (X x) =

Z x

�1f(y) dy

Page 5: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Normal DistributionThe normal distribution (aka Gaussian distribution) is probably the most important distribution in probability and statistics.

Many populations have distributions well-approximated by a normal distribution

Examples: weight, height, and other physical characteristics, scores on tests, etc

Page 6: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Normal DistributionDef: a continuous random variable has a normal (or Gaussian) distribution with parameters

and if its probability density function is given by µ �2

f(x) = 1�p2⇡

e�12 (

x�µ� )2

Exploration! https://academo.org/demos/gaussian-distribution/

If a random variable X is normally distributed we say X ⇠ N(µ,�2)

Page 7: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Standard Normal DistributionDef: a normal distribution with parameter values is called the standard normal distribution

Question: What is the pdf of the standard normal distribution

µ = 0, �2 = 1

fan = ¥,e- ±←

Page 8: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Standard Normal DistributionDef: a normal distribution with parameter values is called the standard normal distribution

A standard normal random variable is typically called Z

µ = 0, �2 = 1

Recall: The normal distribution does not have a closed form cumulative distribution function

We use a special notation to denote the CDF of the standard normal distribution

OI ( z ) = PCZ < z )

Page 9: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Standard Normal DistributionThe standard normal distribution rarely occurs in real life

Instead, it’s a reference distribution that allows us to learn about other (non-standard)normal distributions using a simple transformation

Recall: For computing probabilities, having a CDF is just as good (or better) as having a pdf

Back in the day, you looked up values of the standard normal CDF in normal tables in the back of probability books

Page 10: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Standard Normal Distribution

shaded area = �(z)

standard normal (z) curve

:Z

Page 11: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Standard Normal Distribution

shaded area = �(z)

standard normal (z) curve

shaded area = �(1.25)

Example: What is ? P (Z 1.25)

Page 12: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Standard Normal DistributionExample: What is ? P (Z � 1.25)

Example: What is ? P (Z �1.25)

Example: How can we compute ?P (�0.38 Z 1.25)

PTZT, 1.25 ) = 1- PCZ ? 1.257=1 - $4.257

PCZ 2- - 1.25 ) = 1- $4.25 ) = § (-1-25)

PC - 0.3842<-1.25 )= €4.257 - (1-017.383)

= 01-(1-25) - OIC . .3D

Page 13: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Flip It and Reverse ItExample: What is the 99th percentile of ?

Hmm: We have tables that tell us areas. How can we go from an area to a value?

This is the inverse problem to

N(0, 1)

P (Z z) = 0.99

How could you do this with a table?

$(2.33 )

-

•← .gs

&(2.34 •

2. 32 I ¥ 2 . 33

FROM TABLE.

# ( 2.32 ) - 0.98983

Slope = 01 (

2.33) - §( zzz ,

$( 2.331=0.99010

-AX=0<99 - OIC 2,327

• 01 -SLOPE

⇒ 0.99 = 1042.327+ SLOPE

°A×⇒=

• 0063 ¥2,3263

Page 14: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Flip It and Reverse ItExample: What is the 99th percentile of ?

Hmm: We have tables that tell us areas. How can we go from an area to a value?

This is the inverse problem to

N(0, 1)

P (Z z) = 0.99

How could we do this with Python?

pdf , cdt

sapy .stats . norm . ppf ( 0.9 9)

Page 15: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Flip It and Reverse It

stats.norm has lots of good functions related to normal distributions: pdf, cdf, ppf, etc

Page 16: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Critical ValueNotation: We say is the value of Z under the standard normal distribution that gives a certain tail area. In particular, it is the z value such that exactly of the area under the curve lies to the RIGHT of

z↵↵

z↵

z↵We call the critical value

shaded area = P (Z � z↵) = ↵

=

Z• oz

St .

P ( Z > Zoz ) =.02

q p

• 02

,

Page 17: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

The Critical ValueNotation: We say is the value of z under the standard normal distribution that gives a certain tail area. In particular, it is the z value such that exactly of the area under the curve lies to the RIGHT of

z↵↵

z↵

Question: What is the relationship between and the cumulative distribution function? z↵

Question: What is the relationship between and percentiles? z↵

Plz > za ) =x= 1- PCZ ? z a) = 1- IOAA )

Za is THE look - a) At Percentile

Page 18: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Nonstandard Normal Distributions Nonstandard normal distributions can be turned into standard normals really really easily

Proposition: If X is a normally distributed random variable with mean and standard deviation , then Z is a standard normal distribution if

µ�

Z = ¥1 Cited : E[z]=fE[ × ] - Mg =fµpf=o

Varlz ) = VAR ( E - Mg ) = Vary E) = fzV^r(X)= f. on I ✓✓✓

Page 19: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Nonstandard Normal Distributions Nonstandard normal distributions can be turned into standard normals really really easily

Proposition: If X is a normally distributed random variable with mean and standard deviation , then Z is a standard normal distribution if

µ�

Z =X � µ

�or X = �Z + µ

,

X ⇠ N(µ,�2) Z ⇠ N(0, 1)

Page 20: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

Brake Lights! (in Grandpa-Voice)Example: The time it takes a driver to react to brake lights on a decelerating vehicle is critical to helping to avoid rear-end collisions

The article Fast-Rise Brake Lamp as a Collision Prevention Device (Ergonomics, 1993: 391-395) suggests that reaction time for an in-traffic response to a brake signal from standard brake lights can be modeled as a normal distribution having mean value 1.25 sec and standard deviation 0.46 sec.

Question: What is the probability that a reaction time is between 1.0 sec and 1.75 sec?

1.0 → (1,0-1.25) 1.75 - > (1.75-1.25)⇒6 0,46→ -

• 54 → 1.08 a (i. og) - 10h54's→ PC 1,0111<-1.757 . Pf . 542--2<-1.087 →

Page 21: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the

OK! Let’s Go to Work! Get in groups, get out laptop, and open the Lecture 12 In-Class Notebook

Let’s: o Get some more practice computing normal probabilities in Python

o Look at the way grading curves are often done

o See how we can sample from the standard normal using the Box-Muller method when we don’t have stats libraries readily available

Page 22: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the
Page 23: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the
Page 24: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the
Page 25: The Normal Distribution - Computer Scienceketelsen/files/courses/csci3022/slides… · The Normal Distribution The normal distribution (aka Gaussian distribution) is probably the