Lect - 07 C Gaussain Distribution
Lect - 07 C Gaussain Distribution
EEF 271E
Ibraheem Shayea
Electronics and Communication Engineering Department,
Faculty of Electrical and Electronics Engineering
İstanbul Teknik Üniversitesi - İTÜ
Syllabus 07
Continuous Probability Distributions Functions
Part C
Gaussian (Normal) Distribution
Lecture Objectives
What you should Learn from this Lecture ?
❑ Understanding :
o Concept of Gaussian Distribution
o How PDF can be formulated?
o How CDF can be formulated?
o How it can b used in Matlab
o How is the Mean can be formulated?
o How is the Median can be formulated?
o How is theVariance can be formulated?
o How is the Standard Deviation can be formulated?
o Practice some Examples
Outline
❖ Concept of Gaussian Distribution
❖ Mean
❖ Median
❖ Variance
❖ Standard Deviation
❖ Properties
❖ Examples
Concept of Gaussian Distribution
Concept of Gaussian Distribution
Definition
Dataset 7
Concept of Gaussian Distribution
Important of Gaussian Distribution Function
Many statistical methods and tests are based on the assumption that
the underlying data follows a Gaussian Distribution.
Examples:
o Heights
o Blood pressure
o Measurement error
o Scores
− 𝒙−𝝁 𝟐
𝟏
𝑓 𝑥 = 𝒆 𝟐𝝈𝟐 −∞ <𝒙<∞
𝟐𝝅 𝝈𝟐
where:
o 𝒙 is the random variable.
o 𝝁 is the mean of the distribution.
o 𝝈 is the standard deviation of the distribution.
o 𝒆 is the base of the natural logarithm.
o 𝝅 is the mathematical constant pi (approximately 3.14159). 12
PDF of Gaussian Distribution
PDF of Gaussian Distribution Function
𝝁 mean
▪ can have any finite real value, i.e. −∞ < 𝝁 < ∞
▪ The mean 𝝁 is often referred to as a Location Parameter.
𝝈 Standard Deviation
▪ it is often referred to as a Shape Parameter
▪ 𝝈 can have any finite positive value, i.e. 𝟎 < 𝝈 < ∞
𝝈𝟐 Variance
▪ 𝝈𝟐 can have any finite positive value, i.e. 𝟎 < 𝝈𝟐 < ∞
13
PDF of Gaussian Distribution
PDF of Gaussian Distribution Function
What is Gaussian Distribution Function ?
14
PDF of Gaussian Distribution
Empirical Rule in Gaussian Distribution
𝟐𝝈
𝝈 𝝈
o ≈ 68% of the data falls within 1st standard deviation of the mean
o ≈ 95% of the data falls within 2nd standard deviations of the mean
o ≈ 99.7% of the data falls within 3ed standard deviations of the mean 15
PDF of Gaussian Distribution
Empirical Rule in Gaussian Distribution
16
PDF of Gaussian Distribution
Empirical Rule in Gaussian Distribution
Example
𝟐 𝝈
𝝈 𝝈
𝟐𝝈
𝝈 𝝈
𝟐𝝈
𝟐𝝈
Figure Two examples of a Gaussian random variable X with expected value µ and standard deviation
20
σ.
PDF of Gaussian Distribution
Peak of Gaussian Distribution
Example
Impact of different 𝝈 values on the peak of PDF Gaussian distribution.
where:
o normpdf
ox
o mu
o sigma
PDF of Gaussian Distribution
Matlab Function for PDF Gaussian Distribution
Matlab Example
𝑓 𝑥 = normpdf(x, mu, sigma);
mu = 0;
𝟐𝝈
sigma = 1;
plot(x, y)
mu = 0;
𝟐𝝈
sigma = 1;
plot(x,y)
𝟐𝝈 𝟐𝝈
𝟐𝝈
mu = 0; mu = 0; mu = 0;
sigma = 0.5; sigma = 1; sigma = 2;
25
Figure PDFs of the Gaussian distribution with mean 𝜇 and variance 𝜎 2 .
PDF of Gaussian Distribution
Matlab Function for PDF Gaussian Distribution
Matlab Example
x = [-2:0.1:2];
sigma = 0.5
mu = 0;
sigma = 0.5, 1, 2;
figure
plot(x,y)
sigma = 1
sigma = 2
??
28
CDF of Gaussian Distribution
CDF of Gaussian Distribution
𝑭𝑿 𝒙 = න 𝒇𝑿 𝒙 𝒅𝒙
− 𝒙−𝝁 𝟐
𝟏
𝑓 𝑥 = 𝒆 𝟐𝝈𝟐 −∞ <𝒙<∞
𝟐𝝅 𝝈𝟐
?? 29
CDF of Gaussian Distribution
CDF of Gaussian Distribution
??
30
CDF of Gaussian Distribution
CDF of Gaussian Distribution Function
The cumulative distribution function of the Gaussian random variable, which
is a continuous increasing function, is obtained as follows:
𝑭𝑿 𝒙 = න 𝒇𝑿 𝒙 𝒅𝒙
∞
1 − 𝑥 − 𝜇 2 Τ2𝜎 2
𝐹𝑋 𝑥 = න 𝑒 𝑑𝑥 −∞ <𝑥 <∞
2𝜋 𝜎 2
−∞
31
CDF of Gaussian Distribution
Z-score
𝑋 − 𝜇
𝑍 =
𝜎
32
CDF of Gaussian Distribution
Z-score
❖ The table rows and columns are organized for different values of z,
typically up to two decimal places (e.g., 𝑧 = 1.96).
33
CDF of Gaussian Distribution
Z-score How to Use the Z-Table:
34
https://math.arizona.edu/~jwatkins/normal-table.pdf
CDF of Gaussian Distribution
Z-score How to Use the Z-Table:
𝑧 = 1.96
𝐹 𝑍 ≤ 1.96 = 0.9750
https://math.arizona.edu/~jwatkins/normal-table.pdf
CDF of Gaussian Distribution
Z-score
Example
Let's say you want to find the probability that a value is less than 85 in a
distribution where:
❖ 𝑀𝑒𝑎𝑛 𝜇 = 100
❖ 𝑆𝑡𝑑 𝜎 = 15
So the 𝑭(𝟖𝟓) = 𝟎. 𝟏𝟓𝟖𝟕, meaning there's a 𝟏𝟓. 𝟖𝟕% chance a value from this distribution is less
than or equal to 85.
CDF of Gaussian Distribution
Z-score How to Use the Z-Table:
𝑧 = −1
𝑓(−1) ≈ 0.1587
https://math.arizona.edu/~jwatkins/normal-table.pdf
CDF of Gaussian Distribution
Matlab for CDF of Gaussian Distribution
Matlab
pd = makedist('Normal');
𝑭 𝒙 = cdf(pd,x);
pd is a probability distribution
38
CDF of Gaussian Distribution
Matlab for CDF of Gaussian Distribution
clc
clear all
close all
x = [-4:0.1:4];
mu = 0;
sigma = 1;
pd = makedist('Normal');
cdfp = cdf(pd,x);
figure
plot(x, cdfp); hold on
Gaussian Distribution 40
Mean
Mean
Mean Formula
❖ The mean of a Gaussian distribution function is also known
as the expected value or the average of the function.
∞
Mean = −∞ x f(x) dx
where
o 𝒇(𝒙) is the PDF of Gaussian distribution function,
∞
o −∞ is the integral is taken over the entire real line.
42
Mean
Mean Formula
∞
Mean = −∞ x f(x) dx
∞
1 2 Τ2𝜎 2
Mean = න 𝑥 𝑒 − 𝑥 − 𝜇 𝑑𝑥
2𝜋 𝜎2
−∞
Mean = 𝜇
where
o μ is the mean,
o 𝒇(𝒙) is the PDF of Gaussian distribution function,
∞
o −∞ is the integral is taken over the entire real line. 43
Mean
Mean in Matlab
mu = mean(x);
clc
clear all
close all
x1 = [-4:4];
x2 = [-10:-5];
x = [x2 x1];
mu = mean(x); 44
Mean
Mean in Matlab
Matlab Function for mean
clc
clear all
close all
x1 = [-4:4];
x2 = [-10:-5];
x = [x2 x1];
mu = mean(x);
sigma = 1;
47
𝑴𝒆𝒅𝒊𝒂𝒏
Median Formula
o In Gaussian (Normal) Distribution, mean and median are
equal; both located at the center of the distribution
Median = Mean = 𝝁𝑿 = 𝝁
48
𝑴𝒆𝒅𝒊𝒂𝒏
𝑴𝒆𝒅𝒊𝒂𝒏 in Matlab
o Also, median of Gaussian Distribution Function can be calculated by:
49
𝑴𝒆𝒅𝒊𝒂𝒏
𝑴𝒆𝒅𝒊𝒂𝒏 in Matlab
clc
clear all
close all
x1 = [-4:4];
x2 = [-10:-5];
x = [x2 x1];
mu = mean(x);
sigma = 1; % sigma can be 1, 2, 3, or 4, but will not impact median
𝜎𝑋2 = න 𝑥 − 𝜇𝑋 2 𝑓 𝑥 𝑑𝑥
𝑎
Where
𝜎𝑋2 The Variance for Distribution Function
𝑓𝑋 𝑥 The PDF for Gaussian Distribution Function, which is the value
of the PDF at any 𝑥 value
𝜇𝑋 The Mean for Gaussian Distribution Function
𝑎 The minimum value of 𝑥
𝑏 The maximum value of 𝑥 53
Variance
Variance
The Variance 𝝈𝟐𝑿 of Gaussian Distribution Function is given by:
∞
1 2 Τ2𝜎 2
𝜎𝑋2 = න 𝑥 − 𝜇𝑋 2 𝑒 − 𝑥 − 𝜇 𝑑𝑥
2𝜋 𝜎2
−∞
Where
σ 𝑥−𝜇 𝟐
𝟐
𝝈 =
𝑁
where
o 𝝈 is the standard deviation
o 𝝁 is the mean of the distribution
o 𝒙 is each individual data point
o 𝑵 is the total number of data points
o 𝚺 represents the sum of all the values in the numerator 55
Standard Deviation
Standard Deviation
What is Standard Deviation ?
57
Standard Deviation
How Standard Deviation can be Calculated?
It calculates the average distance of each data point from the
mean, by:
σ 𝑥−𝜇 𝟐
o Dividing by the total number of data points
𝑁
o Finally, the square root is taken to convert the squared units back to the original
σ 𝑥−𝜇 𝟐
units of the data
𝑁
58
Standard Deviation
Standard Deviation Formula
Thus, Standard Deviation of the Gaussian Distribution Function is
calculated by the following Eq.:
σ 𝒙−𝝁 𝟐
𝝈= 𝝈𝟐 =
𝑵
where
o 𝝈 is the standard deviation
o 𝝁 is the mean of the distribution
o 𝒙 is each individual data point,
o 𝑵 is the total number of data points
o 𝚺 represents the sum of all the values in the numerator 59
Standard Deviation
Standard Deviation
In practice, this formula can be difficult to use when dealing with large
datasets or complex distributions, so statistical software such as Excel,
Matlab, R, or Python can be used to calculate the standard deviation of
a Gaussian distribution automatically.
60
Properties
Properties
Properties of PDF (Gaussian Distribution)
𝑭𝑿 𝒙 = න 𝒇𝑿 𝒙 𝒅𝒙
Properties
Properties of CDF (Gaussian Distribution)
𝒅𝑭𝑿 𝒙
𝒇𝑿 𝒙 =
𝒅𝒙
Examples
Examples
Example 01
A certain variety of pine tree has a mean trunk diameter of 𝜇 = 150 cm, and a standard
deviation of 𝜎 = 30 𝑐𝑚, A certain section of a forest has 10000 of these trees.
a) How many of these trees may have a diameter smaller than 120 cm?
b) How many of these trees may have a diameter between 120 and 180 cm?
Solution:
? 65
Examples
Example 01
a) How many of these trees may have a diameter smaller than 120 cm?
Solution:
o = 50 – 34%
o About 16% of these trees have a diameter smaller than 120 cm
o That is 16% of 10000= 1600 trees
o About 1600 trees have a diameter smaller than 120 cm. 66
Examples
Example 01
a) How many of these trees may have a diameter between 120 and 180 cm?
Solution:
o 34%+34% =68% of these trees have a diameter between 120 and 180 cms.
o That is 68% of 10000= 6800 trees
o About 6800 trees have a diameter between 120 and 180 cms. 67
Examples
Example 02
The height of a plant species is normally distributed with a mean (𝝁) of
𝟏𝟎𝟎 𝒄𝒎 and a standard deviation (𝝈) 𝒐𝒇 𝟏𝟓 𝒄𝒎. What is the
probability that a randomly selected plant is taller than 115 𝑐𝑚?
Answer
? 68
Examples
Example 02
Answer
1. Convert to Z-Score:
𝑍 = (𝑋 − 𝜇) / 𝜎 = (115 − 100) / 15 = 1.0
2. Find the Cumulative Probability (𝑷(𝒁 ≤ 𝟏. 𝟎)):
From the Z-Table:
𝑃(𝑍 ≤ 1.0) = 0.8413.
3. Calculate the Probability (𝑷(𝒁 > 𝟏. 𝟎)):
𝑃 𝑍 > 1.0 = 1 − 𝑃 𝑍 ≤ 1.0
= 1 − 0.8413 = 0.1587.
Final Answer:
The probability that a randomly selected plant is taller than 115 cm is 15.87%. 69
Examples
Example 03
A student takes a standardized test where the scores are normally
distributed with a mean (μ) of 500 and a standard deviation (σ) of 100.
What is the probability that the student scores less than 650?
Answer:
Convert to Z-Score:
𝑍 = (𝑋 − 𝜇) / 𝜎 = (650 − 500) / 100 = 1.5
Final Answer:
The probability that the student scores less than 650 is 93.32%.
70
Examples
Example 04
The weights of apples in a certain orchard are normally distributed with a mean (μ) of 200 grams and
a standard deviation (σ) of 20 grams. What is the probability that a randomly selected apple weighs
between 180 grams and 220 grams?
Answer:
1. Convert theValues to Z-Scores:
For X = 180: Z = (180 - 200) / 20 = -1.0
For X = 220: Z = (220 - 200) / 20 = 1.0
Thank You