Hello and welcome back to another class of our course about the complete introduction to data science
and Python.
So in this class, we are still talking about some more statistical concepts and this is what we will
cover in this whole class.
We are going to talk about four very interesting statistical concepts that are very, very used in the
science, as well as in statistics in general, and that we will be really interesting for you guys
to know once again for the purpose of this course, but for your life in general as well.
So let's jump right into it.
So the first official concept that we are going to talk about would be the range.
So basically, let's say you guys are in a deficit and you want to know the range of the numbers that
are in this dataset.
How exactly do you calculate the range of those numbers?
So it's pretty simple.
You take the highest numbers to the max minus the lowest number, which is the mean, and this would
give you the range of those numbers.
So, for example, in this case, as you can see, the max would be eight and the minute is well, in
this case four, because this is where it starts.
So the range would be four.
So basically, if we read the definition could be the difference between the max and the men in dataset.
So it will allow us to know what is the spread in the data or the data that we have.
So basically the highest number that we have, minus the lowest number that we have, and this would
be Erving's swendson in this example right here, the range will be 10.
So the highest number is 12 and the lowest number would be all right.
The second thing that we are going to talk about would be quartiles and basically this or percentiles.
So basically do those things which will allow us to know, for example, who is the 10 percent best,
where the 10 percent where starts of something, where it's just a measure in statistics.
So basically, this is a division of observations and two to four defined points.
So you have the Q1 to Q2, to Q3.
And as you can see right here, we have a graph of cordials.
So basically the Q1 would be the twenty fifth percentile.
The Q2 is basically the median or the center.
So basically this would be the center and finally the Q3 would be the seventy fifth person, though.
So if we take a basic example of some numbers like here, for example, we have the two four, four,
five, six, seven, eight.
So in this case, the Q1 would be four.
So it would be the twenty five percent, the median would be five.
The third.
Q The Q3 would be seven.
So the seventy fifth percentile and the max would be eight.
The main would be two.
So once again this is these are just basics.
But let's say you have a dataset of one hundred numbers.
In this case it's pretty simple.
The 25th percentile would simply be the twenty fifth number, the 58 the 58 percentile or the median
would be the 58 number and the Q3 was 70 percent.
That would be the seventy fifth number.
So this is just a division into percentages.
So the first 10 percent would be the on the tenth percentile.
So the worst percentiles.
Right.
The next thing that we are going to talk about will be the standard deviation.
And this is where it will be a bit more complicated because, well, the formulas are a bit more complicated.
So first of all, what is the standard deviation?
Basically, the standard deviation is the measure of variation or dispersion of a dataset and something
that is really, really used in finance as well with the variation that we are going to talk about.
Well, the variance sorry that we are going to talk about a bit later in this class.
So basically the standard deviation works well with the data sets and the way it's calculated could
be calculated on a sample as well as on a population.
So this is the formula, basically, and what exactly does it mean?
It's pretty simple.
So we have the X right here, the X would be our numbers.
So let's say, for example, have a data set of one, two, three, four.
So it will simply be one minus the mean of our data sets.
In this case, it could be one, two, three, four.
So the mean of one, two, three, four, all this at two.
So basically you make the square square feet.
So you you multiply it by itself and you make the addition of everything.
So it's going to be, for example, in this case and if we have a dataset of one, two, three, four,
there's going to be one minus the mean of our data set everything multiplied by itself, plus two minus
our mean multiplied by itself, plus three minus the mean but multiplied by itself, plus four by the
multiple of minus four multiplied by itself and everything divided by the number of numbers that we
have.
So if in our dataset we have four numbers, it's going to be four minus one, which would be three for
a population that's a bit more different instead of making minus one at the end.
So we will simply divide it by the number of numbers that we have.
And at the end it's going to be the square feet of the square square root of everything.
How to interpret the variance, the standard deviation.
So it's pretty simple.
So basically you let's say you have a dataset and you have a mean of 10, and in this mean often you
have a standard deviation of two.
So basically, if you add to your mean or your average one standard deviation, you have sixty eight
percent of chances to be on target.
If, for example, I don't know you are.
Well, it's really used in the stock market.
So let's say you want to predict the year you're stuck, it goes up or down by how much.
So it's pretty simple.
You will simply take your data, the data of the stock, and then you will simply calculate the standard
deviation of this data.
So let's say, for example, the the mean or the average of this data would be 10 with a standard deviation
of one.
So in this case, the price of your stock has six to eight percent of chances to be ten plus one or
ten minus one.
So it's going to be between nine dollars and 11 dollars in the next well, in the next X amount of times.
So if you want to have ninety five percent of chances to be right, it's going to be ten dollars plus
two standard deviation.
So in this case, it's going to be two multiplied by your standard deviation or ten minus two multiplied
your standard deviation.
So your stock would be between eight and 12 in this case because you have a stock that has an average
of ten dollars and a standard deviation of one.
So it's pretty simple and it's the same thing for three standard deviation.
If you want to have ninety nine point seven percent of chances to be on target, well, you're the price
of your stock would be between seven dollars and 13 dollars.
So those would be your extremes or those would be like if you want to be sure to be one well, ninety
nine point seven percent having nineteen point seven percent of chances to be on target or hitting your
stock price, you will add three standard deviation, usually around three.
Standard deviation is not that much of a good thing because, well, it doesn't give you the opportunity
to take risks or your risk is really, really small.
So the profit that you will make would be also really, really small.
So this is pretty standard deviation.
The next thing that we are going to talk about would be the variance.
So basically the variance is pretty much like the standard deviation.
The only difference is that you will well, basically the standard deviation is simply the square root
of the variance.
So basically the variance is simply the standard deviation of at A2, some standard deviation multiplied
by two.
So basically how it works, it does pretty much the same thing as the standard deviation.
It's a measure of spread in a certain dataset, so it works pretty much the same as the standard deviation.
So usually people don't really use it.
People use the standard deviation.
But but it's also really, really important to understand.
So as I said, the method of calculation is the same thing as the standard deviation.
You have to measure the calculation for a population or for example, the main difference is the end
right here.
So it would be all the numbers that we have or if you calculate it for a sample, it will be all the
numbers that we have.
I just want to say, for example, you have a set of 10 numbers is going to be ten minus one, you will
divide it by ten minus one at the end.
And if we compare both formulas, as you can see, for this standard deviation, it's pretty much the
same thing.
The only difference is that you have a square root.
That is the only difference.
So basically the variance is simply the standard deviation multiplied by itself.
So it's pretty much the same thing.
Well, with the difference, because it's multiplied by itself.
But at the end of the day, it give us the same measure measures the spread of a certain dataset.
So this is really important to understand.
So those were the things that we talked about in this class.
So first of all, we talked about the range, which is simply the max minus the minute.
Then we talked about the quartiles, quartiles, which are percentiles as well.
So you have the twenty fifth, the median and the seventy five percentile, which are Q1, Q3 to Q1,
Q2 and Q3.
So quarter one quarter to quarter.
And then we talked about the standard deviation, which is a measure of spread and that aceto measure
of spread.
So you just to know what is the spread or how much something is volatile.
So if we use that, for example, on a stock, it's a good way to know how much stock is volatile and
how much risk we are ready to take.
And then we talked about the variance, which does pretty much the same thing as the standard deviation.
But if you guys want to use something, for example, to predict stocks, once again, I really and
highly suggest you to use the standard deviation, which is way better.
So that's why this class guys and you all in our next class where we are still talking about statistics.