Python Endsem PPT
Python Endsem PPT
Chi-Square,
Normal Distribution, and
Z-Score Standardization
in Python
@Sumitra Pun
@Dhanraj Kumar
Introduction
3 Importance 4 Applications
Many natural phenomena and Widely used in hypothesis
statistical data follow the testing, regression analysis,
normal distribution, making it and other statistical modeling
a foundational concept. techniques.
Visualizing Normal Distribution
in Python
import numpy as np Generate Random Data
1
import matplotlib.pyplot as plt Use NumPy to create a sample from a normal distribution.
data = np.random.normal(0, 1,
1000) # Mean=0, Std=1 2 Plot the Distribution
density=True)
plt.title("Normal Distribution") Annotate the Plot
3
plt.show() Add labels, title, and highlight key features like the mean and
standard deviation.
Z-Score Standardization
What is a Z-Score? Why Use Z-Scores?
A z-score represents how many standard deviations a data Z-scores are essential for normalization, outlier detection, and
point is from the mean, allowing for direct comparisons comparing variables with different scales or units.
across different data sets.
Z-Score Calculation in Python
Calculate Mean
Determine the mean of the data set using NumPy.
import numpy as np
Calculate Standard Deviation
data = [10, 20, 30, 40, 50]
Calculate the standard deviation of the data set using NumPy.
mean = np.mean(data)
std = np.std(data)
Apply Z-Score Formula
z_scores = [(x - mean) / std for x in
For each data point, subtract the mean and divide by the standard deviation.
data]
print(z_scores)
Interpret Z-Scores
Examine the z-scores to identify outliers and compare data points across
different variables.
Comparison and Key Takeaways
Chi-Square vs. Normal Importance of Z-Scores
Distribution
Z-scores enable standardization, outlier
Chi-square is used for categorical data, detection, and meaningful comparisons
while the normal distribution is used across different variables and data
for continuous data. Both are essential sets.
for statistical inference.