Source

Adapted from my own handwritten and hand-typed notes from Year 1 to Year 3 of my EEE degree

Bivariate exploration looks at two variables together, e.g. HP and Attack, to answer:

  • is there a mutual dependence
  • what is the mutual relationship

Joint Plot

A joint plot is a scatter plot of the two variables (here HP on the y axis and Attack on the x axis) with each variable's histogram on the margins. For Pokemon, HP tends to increase as Attack increases, and the dependence is moderately strong.

Correlation Coefficient

The correlation coefficient measures how strongly two variables move together in a straight line. It is the covariance divided by the product of standard deviations:

ValueMeaning
perfect positive linear relation
no linear dependence
perfect negative linear relation

For HP and Attack, : a moderate positive relation.

Things to keep in mind:

  • correlation only captures linear relations, a strong curved pattern can still give
  • correlation is not causation

Correlation Matrix and Heatmap

jointDF = pd.concat([hp, attack], axis=1).reindex(hp.index)
sb.jointplot(data=jointDF, x='Attack', y='HP', height=12)
 
jointDF.corr()                                   # 2 x 2 correlation matrix
sb.heatmap(jointDF.corr(), vmin=-1, vmax=1, annot=True, fmt='.2f')

The same idea scales up to many variables at once in Multivariate Exploration.