Search⌘ K
AI Features

Correlation Matrices

Explore how to compute, visualize, and interpret correlation matrices for bivariate and multivariate data analysis using Plotly. Understand Pearson’s correlation coefficient and learn to create effective heatmaps that highlight variable relationships. This lesson equips you to assess data interactions and enhance your exploratory data analysis skills with interactive visuals.

Correlation matrix

The Pearson’s correlation coefficient (also known as Pearson’s rr) is a statistic that measures the degree to which two variables move together in a linear fashion. Correlation takes on a value between -1 and 1, in which r=1r=-1 implies perfect negative correlation (points move together in a perfect straight line with a negative gradient) and r=1r=1 implies perfect positive correlation (points move together in a perfect straight line with a positive gradient).

The image below details how correlation can be judged as a rule of thumb from Straightforward Statistics for the Behavioral Sciences. (Evans JD, 1996). To judge a negative correlation, just place a minus sign before each number in the table below:



Correlation Value Description
r = 0 – 0.19 very weak relationship
r = 0.20 – 0.39 weak relationship
r = 0.40 – 0.59 moderate relationship
r = 0.60 – 0.79 strong relationship
r = 0.80 – 1. very strong relationship

Here is the formula for correlation, however, we don’t need to compute it from scratch:

r=i=1n(xixˉ)(yi ...