Variance & Standard Deviation 101
João Augusto Perin
Posted on July 5, 2021
Well, Hi there! This is my first Dev.to post, and I'm really excited to begin here! 😁
Perhaps, you already know me from my Tumblr, or my Medium. But nice, and original content will be written here, so take a seat!
To start off, I decided to share a little piece of mathematical knowledge, that, although simple, it is very common to forget, or simply don't come across. But is very useful, and, if you want to follow the path of machine learning, for instance, it is a must know basic concept.
So let's jump in!
O.b.s: I'm assuming you already know the base concepts of statistics. Such as average, mode and median.
Variance
You can think variance, just like the average means like the "center" of the data, variance can mean how the data actually behaves around that "center".
For instance, let's take the mean of these table, which show how many hours of sleep Greg had last week:
Week day | Hours Slept |
---|---|
Monday | 7 hours |
Tuesday | 8 hours |
Wednesday | 6 hours |
Thursday | 0 hours |
Friday | 7 hours |
Saturday | 7 hours |
Sunday | 10 hours |
This data gives as a average of: 7,6 hours slept per night.
But, let's change the question here, and if we want to know ˜how constant˜ is the sleeping behavior of Greg?
So, now we want to know, having an average behavior of 7,6 hour slept/night, how constant was these hours?
Variance is defined by:
Σ(average - x)² / n
-> x being the hours slept.
-> n being the amount of data.
So, the example above would evaluate to:
(7-6.42)² + (8-6.42)² + (6-6.42)² + (0-6.42)² + (7-6.42)² + (7-6.42)² + (10-6.42)²
which would result: 10.38
Standard Deviation
Now that you understood variance, the standard deviation, is used to minimize the noise made by the ²'s on variance's formula.
Calculate de SD by: sqrt(variance)
In our case, it will be: 3.22
If you're a little advanced in Maths, you can think of variance as the value of a function y, and the SD being the derivative of the same function. 😉
Foreword
Both have lots of use-cases, that I pretend to bring here on future posts. Hope it helps! 😁
Posted on July 5, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.