course content

Course Content

Learning Statistics with Python


Correlation describes the degree to which two variables move in coordination with one another.

With the correlation, we can easily examine the result. The correlation can be the number in the interval [-1; 1]. Look at the table:

The value of correlationMeaning
1The perfect positive correlation; if the one value increase, the other increases too, and vice versa
0There is no correlation
-1The perfect negative correlation; if the one value increase, the other decreases, and vice versa

Correlation with Python:

To calculate correlation, we will use the function from NumPy np.corrcoef() with two parameters: the sequences of data between which we want to find correlation. Look at the example:

Here, we will extract the number with the index [0, 1] — the same as in the case with covariance. In the previous chapter, we received the number 74955.85, analyzing the result of the applying correlation function is hard. But, here, we can conclude that the values are related almost perfectly.

Section 4.

Chapter 2