Correlation Coefficient and Visualization
This page covers the correlation coefficient, which shows the relationship between variables as a number, and how to pick the right chart for a question.
Correlation Coefficient
A value from -1 to 1 that shows how much two variables move together (Pearson correlation coefficient). Close to 1 means they increase together, close to -1 means one decreases as the other increases, and close to 0 means there is almost no linear relationship. A high correlation does not mean one causes the other.
In A1-1, the correlation coefficient between unit price and quantity was -0.379, showing a tendency to buy more of cheaper products. Image mean and amount was -0.012, almost 0. Since the images were attached at random, this was the expected result.
6 Visualization Types
| Chart | Use it when | What was drawn in A1-1 |
|---|---|---|
| Histogram | Showing the shape of one value's distribution | Quantity and unit price distributions |
| Box plot | Quartiles and outliers, comparing before and after processing | Quantity before and after clipping |
| Bar chart | Comparing counts by category | Number of customers per segment |
| Heatmap | Showing table-shaped values as colors | Correlation matrix between variables |
| Scatter plot | Relationship between two numeric variables | Unit price and quantity (sample of 5,000) |
| Line chart | Change over time | Monthly sales trend |
Interview Questions
Q. If the correlation coefficient between unit price and quantity is -0.379, how do you interpret it?
This checks whether you go beyond reading the number and also know what the correlation coefficient doesn't tell you.
It is a negative correlation, so there is some tendency for order quantities to be smaller as the unit price gets higher. However, the correlation coefficient only looks at linear relationships. Also, in A1-1 it was calculated with outlier-clipped values, so the number could be different if calculated with the original values. You can't go as far as claiming a causal relationship that people buy more because the unit price is low.
Follow-up Questions
- If the correlation coefficient is high, is one variable the cause of the other? → No. It only means they move together, and there may be another factor affecting both variables.
Source: dubu-alt/A1-1 (Codyssey AI Advanced A1-1 mission)
