Standard Deviation

Yaser Rahmati | یاسر رحمتی

Definition

Standard deviation is a measure of how spread out the values in a data set are.

Example

Let’s say we have the following data set:

2, 4, 4, 4, 5, 5, 7, 9

Step 1: Find the Mean

First, find the mean (average) of the data set:

Mean = (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) / 8 = 40 / 8 = 5

Step 2: Find the Differences

Next, find the differences between each value and the mean:

Differences: (-3, -1, -1, -1, 0, 0, 2, 4)

Step 3: Square the Differences

Now, square each of the differences:

Squared differences: (9, 1, 1, 1, 0, 0, 4, 16)

Step 4: Find the Mean of the Squares

Then, find the mean of the squared differences:

Mean of squared differences = 
(9 + 1 + 1 + 1 + 0 + 0 + 4 + 16) / 8 = 32 / 8 = 4

Step 5: Take the Square Root

Finally, take the square root of the mean of the squared differences to get the standard deviation:

Standard deviation =4 = 2

Therefore, the standard deviation of the given data set is 2.

Python

import numpy as np

number = [2, 4, 4, 4, 5, 5, 7, 9]

sd = numpy.std(number)

print(sd)

My Training Video

My Aparat Channel

Keywords

Web Development (Django, Flask) , Data Science (Pandas, NumPy, Matplotlib) , Machine Learning (Scikit-learn, TensorFlow, PyTorch) , Artificial Intelligence , Automation , GUI Development (Tkinter, PyQt) , Game Development (Pygame) , Scientific Computing , Financial Analysis (Pandas, NumPy) , Network Programming , Image Processing (OpenCV) , Web Scraping (Beautiful Soup, Scrapy) , Internet of Things (IoT) Development , Robotics , Cybersecurity , Mobile App Development (Kivy) , Cloud Computing (Boto3, AWS Lambda) , Big Data Analysis (PySpark) , Geographical Information Systems , Natural Language Processing (NLTK, spaCy) , Data Visualization (Seaborn, Plotly) , Bioinformatics (Biopython) , Multimedia Applications , Education and Teaching

Last updated