The correlation coefficient is to this really popular way of summarizing a scatter plot into one single number between minus one and one. And in this video I'll show you three formative three steps to how that's done. Okay, so I'll work with example scatter plots like this. It shows four movies. On the x-axis we can see the movie's length, and on the y-axis we're rating for the movie between 0 and 5 stars. The first step for the correlation coefficient is that it fits a straight line to the data. So in this example the line would go somewhere like here. And this is your standard straight line fit. So the one that minimizes the square distances between the fitted line and the individual data points. In the second step the correlation coefficient simply remembers if the slope from the straight line fit is pointing upwards or if it's pointing downwards. So in the first data set we saw that the slope is positive. And in that case the correlation coefficient is positive as well. I already mentioned that the correlation coefficient is always between minus one and one. So if the slope is positive the correlation coefficient will be between 0 and 1. Then in the second case in this data set you can see that the longer movies tend to get the worse ratings so the slope is negative. In that case the correlation coefficient is negative as well. It will be between 0 and minus 1. And then there's the third case and that's that the slope is perfectly straight. In this data set you can see that there's no real difference between the longer and the shorter movies in terms of rating. And actually if I draw in the regression line you can see that it's perfectly straight. And in that case the correlation coefficient is 0. So just by looking at the sign of the correlation you already know something about your data. If the correlation is positive you know that the oval trend is upwards. If the correlation is negative you know that the oval trend is downwards and if the correlation is 0 you know that the oval trend is level. So now comes just the third step but this one is trickier. So so far we already know whether the correlation coefficient is between 0 and 1 or 0 and minus 1. But we don't know its magnitude yet. So how big is the value? Is it close to the extreme value so it's something like 0.92 or minus 0.92 or is it small in magnitude because the correlation is weak so it's closer to 0. The correlation coefficient figures this out by looking at the quality of the fit of the straight line for the data. And I'll try to give you an intuition for this first. So here are three scatter plots and I've already drawn in the regression lines. Now which of these three lines fits its data the best? What do you think? Well so it's this one because the data fits most snugly around it. And which line fits its data the worst? Okay so that's that one because the data scatters the most around it. So in these three plots the highest correlation would be in this plot. And the lowest correlation would be in this plot. Actually the correlation coefficient for the first plot is around 0.81 and the correlation coefficient for the worst plot is 0.32 so it's much lower. But how does the correlation coefficient figure this out? Well it compares two things. The first thing it looks at is the scatter along the y-axis. So if I draw in the y values you can see how they scatter along the y-axis. The second thing it looks at is the scatter of the data around the fitted line. So that corresponds to these distances here. And the rule goes like this. The more there's of this in comparison to this the stronger the correlation coefficient is. Okay let me show you a few examples. So in this dataset we can see that there's quite a lot of scatter along the y-axis. But there's really little scatter around the fitted line right because the distances here of the data points from this fitted line they are really short. Okay so in comparison there's a lot more scatter along the y-axis than there's scatter around the fitted line. And in this case the correlation coefficient is really large in magnitude. This is a positive slope so the correlation coefficient is close to 1. It's actually 0.95 so that's a really strong correlation. And here's the second case. So you can see that again we have quite some scatter along the y-axis. But in this example the scatter around the fitted line is also really large right. The points are really far away from the fitted line. Okay so in comparison there's only somewhat more scatter along the y-axis than there's scatter along the fitted line. So in this case the correlation coefficient is weaker. It's 0.56 actually. That's still decent correlation but it's less than before. In this third case the fitted line actually turns out to be straight. So what this means for the data is that the scatter along the y-axis and the scatter around the fitted line they are actually exactly equal. And in this case the correlation coefficient is exactly 0. So you can see that if the scatter along the y-axis is much larger than the scatter around the fitted line that then we get correlation coefficients which are really large in magnitude. But if the scatter along the y-axis and the scatter around the fitted line are really similar then we get correlation coefficients which are close to 0. So now we know the three steps of the correlation coefficient. Let's see how this can help us with an example. So here two scatter plots and the question is which one has the larger correlation coefficient. So the first step is to fit the straight lines. So they go here and here. And then step two is to remember the slope of these lines. Well they are both positive. So in this case you already know that both our correlation coefficients will be between 0 and 1. So in the third step we have to compare the scatters around the y-axis against the scatters around the fitted lines. Okay let's look at the y-axis first. So in the first scatter plot we have these y-values. And in the second scatter plot we have these y-values. And we can already see that the scatter along the y-axis is larger in this scatter plot. Okay how about the scatter along the fitted line? So if I draw in the distances between the points and the lines you can see that they are actually the same in both plots. So now we can make the comparison because we know that the scatter around the line on the left side and the scatter around the line on the right side are the same. But the y-axis scatter on the left side is larger than the y-axis scatter on the right side. So the left scatter plot must have the larger correlation coefficient. So we've seen that these are the three steps in getting your correlation coefficient. First you have to fit the straight line. Then you have to remember if the slope is going up or down to get the sign of the coefficient. And in the third step you get the magnitude of the coefficient by comparing the two scatters along the y-axis and around the fitted line.