Normal Curve
Modelling data | Normal Model
© University of Sydney MATH1062
15 August 2024
Course Overview
Population
3 Sampling Data 4 Decisions with Data
1 Exploring Data Sample 2 Modelling Data
2/40
Module2 Modelling Data
Normal Curve
What is the Normal Curve? And what does it have to do with sample mean?
Linear Model
How can we describe the relationship between two variables? When is a linear
model appropriate?
3/40
Normal Curve
Data story
The normal curve
Area under normal curves
Special properties
· 68/95/99.7% rule
· rescaling
· symmetric about the mean
Qantiles
Summary
4/40
Data story
How likely is it to find an elite netball goal player in Australia?
ABC News
6/40
“A total of 10 goal players (goal shooters, goal keepers, goal attacks and goal
defenders) … were all over 189cm in height”.
Statistical Thinking
How could you investigate the proportion of Australian women who are over 189cm
in height (potential elite goal players)?
· Collect the heights of Female students in the unit. For example, we have the
data collected from “Statistical Thinking with Data” (MATH1005) in 2022 S2
Then we have two options:
· Use the data to represent the population
· Use the data to create a model for the population
7/40
Investigation: Data from MATH1005, 2022 S2
math1005 = [Link]("data/math1005_cleaned.csv", header = T)
FemaleHeights = math1005$Height[math1005$Gender == "Female"]
FemaleHeights = [Link](FemaleHeights)
length(FemaleHeights) # There were 109 female students
## [1] 109
hist(FemaleHeights, main = "Histogram of Female students", xlab = "Heights (cm)",
freq = F)
8/40
mean(FemaleHeights)
## [1] 164.8633
sd(FemaleHeights)
## [1] 7.516324
sum(FemaleHeights > 189)/length(FemaleHeights) # sum(...) counts the number of FemaleHeights > 189
## [1] 0
How many students could be elite goal players?
· In this sample, none! But we know there are women in Australia taller than 189cm…
9/40
We can draw a smooth curve to approximate the density-scale histogram. This curve
may extend beyond the range of observed data in the sample to allow us to answer the
reseach question.
How would you describe it’s shape?
· Fairly symmetric and bell-shaped. Is there something special about this curve?
10/40
Normal curve
Origins
The Normal curve was defined around 1720 by Abraham de Moivre, also famous for the
beautiful de Moivre’s formula.
12/40
Why is the normal curve famous?
· The Normal curve approximates many natural phenomena.
· The Normal curve can model data caused by combining a large number of
independent observations. (Coming up in a future lecture after introducing
probability)
· Many of its properties can be obtained using elementary single variable calculus.
13/40
General & Standard Normal curves
· The General Normal Curve (𝑋) has any mean and SD. Caution: It is denoted by
𝑁 (mean, Variance), where Variance = SD2 .
· The Standard Normal Curve (𝑍 ) has mean 0 and SD 1. Short: 𝑁(0, 1)
14/40
The Normal curve formula
The general normal curve can be described by the formula
1 −
(𝑥−𝜇)2
𝑓(𝑥) = 𝑒 2𝜎 2 for 𝑥 ∈ (−∞, ∞)
√‾2𝜋𝜎
‾‾‾‾2
where we can control the shape by (𝜇, 𝜎):
· 𝜇 is the mean, or the centre of the curve
· 𝜎 is the standard deviation, or the spread of the curve.
15/40
Area under normal curves
Area under a normal curve
The area under any general normal curve 𝑁(𝜇, 𝜎 2 ), bounded by some interval (𝑎, 𝑏), is
given by
𝑏
1 (𝑥−𝜇)2
∫𝑎
−
𝑃 (𝑎 < 𝑋 < 𝑏) = 𝑒 2𝜎 2 𝑑𝑥
√‾2𝜋𝜎
‾‾‾‾2
· The total area under the normal curve (between 𝑎 = −∞ and 𝑏 = ∞) is 1.
· 𝑋 denotes data following a general normal curve with mean 𝜇 and SD 𝜎 .
· 𝑃 (𝑎 < 𝑋 < 𝑏) denotes the proportion of data falling into the interval (𝑎, 𝑏).
· We will later use this notation also for probability and random variables.
17/40
Simplification: area under the standard normal curve
We start with a data 𝑍 modeled by the standard normal curve 𝑁(0, 1). As 𝜇 = 0 and
𝜎 = 1, the proportion of data falling into the interval (𝑎, 𝑏) is
𝑏
1 − 𝑧2
∫𝑎
𝑃 (𝑎 < 𝑍 < 𝑏) = 𝑒 2 𝑑𝑧.
‾‾
‾
√2𝜋
For example, the proportion of data is 0.7 or lower is given by the area up to 0.7.
But how to calculate this?
18/40
Method 1: Integration
By its definition, we could use integration:
0.7
1 − 𝑧2
∫−∞
𝑃 (𝑍 < 0.7) = 𝑒 2 𝑑𝑧
‾‾
‾
√2𝜋
But this does not have a closed form.
19/40
Method 2: Normal tables (not for assessment)
This is the old way. We table the values of the integral.
20/40
Method 3: Use R
· The pnorm(x) command works out the lower tail area, it gives
𝑥
1 − 𝑧2
∫−∞
𝑃 (𝑍 < 𝑥) = 𝑒 2 𝑑𝑧
√‾‾
‾
2𝜋
· The pnorm(x,[Link]=F) works out the upper tail area, it gives
∞
1 − 𝑧2
∫𝑥
𝑃 (𝑍 > 𝑥) = 𝑒 2 𝑑𝑧
‾‾
‾
√2𝜋
· We also have
𝑃 (𝑍 > 𝑥) = 1 − 𝑃 (𝑍 < 𝑥) or upper tail area = 1 − lower tail area
· It is useful to sketch the normal curve and the relevant area … and then use R.
21/40
Lower tail
What proportion of data is 0.7 or lower?
𝑃 (𝑍 < 0.7) ≈ 0.76
pnorm(0.7)
## [1] 0.7580363
22/40
Upper tail
What proportion of data is 0.7 or higher?
𝑃 (𝑍 > 0.7) ≈ 0.24
pnorm(0.7, [Link] = F)
## [1] 0.2419637
1 - pnorm(0.7) # alternative way
## [1] 0.2419637
23/40
Interval
What proportion of data is between -0.3 and 0.7?
𝑃 (−0.3 < 𝑍 < 0.7) = 𝑃 (𝑍 < 0.7) − 𝑃 (𝑍 < −0.3) ≈ 0.38
0.7 −0.3
∫−∞ 𝑓(𝑧)𝑑𝑧 ∫−∞ 𝑓(𝑧)𝑑𝑧
pnorm(0.7) - pnorm(-0.3)
## [1] 0.3759478
24/40
Area under general normal curves
Heights of female students in MATH1005
mean(FemaleHeights)
## [1] 164.8633
sd(FemaleHeights)
## [1] 7.516324
· The heights of female students in MATH1005 has a mean of 164.9cm and a
standard deviation of 7.52cm.
· Now we can model the heights of all Australian women with a normal curve with
mean 164.9cm and standard deviation of 7.5cm.
25/40
Lower tail
Suppose the heights of Australian women follow a normal distribution with mean
164.9cm and sd 7.5cm. What proportion of women will have height less than 170cm?
m = mean(FemaleHeights)
s = sd(FemaleHeights)
pnorm(170, m, s) #pnorm(x,mean,sd)
## [1] 0.7528247
26/40
Upper tail
What proportion of women will have height greater than 189cm? How likely is to find an
elite netball goal player in Australia?
m = mean(FemaleHeights)
s = sd(FemaleHeights)
pnorm(189, m, s, [Link] = FALSE) #upper tail, pnorm(x,mean,sd)
## [1] 0.0006608243
1 - pnorm(189, m, s) # 1 - lower tail
## [1] 0.0006608243
27/40
Properties of the normal curve
1. “68%-95%-99.7% Rule”
All normal curves satisfy the “68%-95%-99.7% rule”:
· The area 1 SD out from the mean in both directions is 0.68 (68%).
· The area 2 SDs out from the mean in both directions is 0.95 (95%).
· The area 3 SDs out from the mean in both directions is 0.997 (99.7%).
Under a normal curve, it has a low chance (0.3%) to have data points that fall more than
3 SD away from the mean.
29/40
2. Rescaling
Any general normal curve can be rescaled into the standard normal curve.
Consider data 𝑋 following a general normal curve 𝑁(𝜇, 𝜎 2 ). For any point on this
normal curve, recall that the standard unit (or 𝑧 score) is how many standard deviations
that point is above (+) or below (-) the mean.
data point - sample mean 𝑥−𝜇
standard unit = or 𝑧=
sample SD 𝜎
· The standard units give the relative location of a data point on the standard normal
curve.
· The proportion under a general normal curve 𝑃 (𝑋 < 𝑎) is equivalent to the
𝑎−𝜇
proportion under the standard normal curve 𝑃 (𝑍 < 𝜎 )
30/40
The proportion of data modelled by 𝑁(𝜇, 𝜎 2 ) falling below 𝑎 is
𝑎
1
∫−∞
𝑥−𝜇 2
− 12 ( 𝜎 )
𝑃 (𝑋 < 𝑎) = 𝑒 𝑑𝑥.
√‾2𝜋𝜎
‾‾‾‾
2
𝑥−𝜇
Apply the change of variable (standardisation) 𝑧 = 𝜎
𝑎−𝜇
𝑎
1 1 − 12 𝑧2 𝑑𝑥
∫−∞ ∫−∞
2 𝜎
− 12 ( )
𝑥−𝜇
𝑒 𝜎 𝑑𝑥 = 𝑒 𝑑𝑧
√‾2𝜋𝜎
‾‾‾‾
2
√‾2𝜋𝜎
‾‾‾‾
2 𝑑𝑧
where
𝑥−𝜇 𝑑𝑥
𝑧= ⟹ 𝑥 = 𝜎𝑧 + 𝜇 ⟹ =𝜎
𝜎 𝑑𝑧
so the proportion simplifies to
𝑎−𝜇
1 − 1 𝑧2 𝑎−𝜇
𝑑𝑧 = 𝑃 (𝑍 <
∫−∞ 𝜎 )
𝜎
𝑃 (𝑋 < 𝑎) = 𝑒 2
‾‾
‾
√2𝜋
𝑎−𝜇
which is the proportion of data modelled by 𝑁(0, 1) falling below 𝜎 .
31/40
Example 1
· Consider the point = 8.
· So the 𝑧 score of the point is 8−5 = 1.
3
32/40
The following 2 areas are of the same size.
pnorm(8, 5, 3)
## [1] 0.8413447
pnorm(1)
## [1] 0.8413447
33/40
Example 2
· Here the lower point is 10 and the upper point is 14.
· So the 𝑧 scores are 𝑧1 10−10 14−10
= 2 = 0 and 𝑧2 = 2 = 2.
34/40
The following 2 areas are of the same size.
pnorm(14, 10, 2) - pnorm(10, 10, 2)
## [1] 0.4772499
pnorm(2) - pnorm(0)
## [1] 0.4772499
35/40
3. The normal curve is symmetric about the mean
If 𝑍 follows the standard normal curve 𝑁(0, 1), then
𝑃 (𝑍 < −𝑎) = 𝑃 (𝑍 > 𝑎)
The red areas below are of the same size (where 𝑎 = 0.5 ).
36/40
More generally, if 𝑋 follows a general normal curve 𝑁(𝜇, 𝜎 2 ), then
𝑃 (𝑋 < 𝜇 − 𝑎) = 𝑃 (𝑋 > 𝜇 + 𝑎)
mu = 10
sigma = 2
a = 2
pnorm(mu - a, mu, sigma) # lower tail
## [1] 0.1586553
pnorm(mu + a, mu, sigma, [Link] = F) # upper tail
## [1] 0.1586553
37/40
Quantiles
Calculate the quantiles of normal curves using R
The function pnorm() finds “the proportion of data 𝑋 following a normal curve falling
below the value 𝑎 ”, we are also interested in
· What is the quantile 𝑄 such that p% of the data 𝑋 falling below the value 𝑄?
Similar to the proportion, there is no close-form solution for the quantiles of normal
curves. We can calculate the quantiles using qnorm(x, mu, sigma) in R.
mu = 10
sigma = 2
qnorm(0.7, mu, sigma) # 70-percentile of N(10, 4)
## [1] 11.0488
qnorm(0.5, mu, sigma) # 50-percentile (or the median) of N(10, 4)
## [1] 10
###
qnorm(0.7) # 70-percentile of the standard normal N(0, 1)
## [1] 0.5244005
qnorm(0.5) # 50-percentile (or the median) of N(0, 1)
## [1] 0
39/40
Summary
· The Normal curve naturally describes many histograms, and so can be used in
modelling data.
· It can be described by the mean and the variance (SD2 ).
· Area under normal curves and pnorm .
· It has many useful properties, including the 68/95/99.7% rule.
· Any general normal can be rescaled into a standard normal.
· The normal curve is symmetric about the mean.
· Qantiles and qnorm .
40/40