Covariance & Correlation
While Joint Distributions tell us where the probability is, Covariance and Correlation tell us how two variables move together.
1. Covariance: The "Raw" Movement
Covariance measures the direction of the linear relationship between two variables.
The Computational Formula (The Shortcut)
In practice, we rarely use the formula above. We use this much simpler "shortcut":
Interpretation:
- Positive Covariance: When is high, is also high.
- Negative Covariance: When is high, is low.
- Zero Covariance: No linear relationship.
Properties of Covariance:
- Symmetry: .
- Covariance with Self: .
- Linearity: .
- Variance of a Sum: .
2. Correlation: The "Standardized" Movement
The problem with Covariance is that its units are "units of times units of ." If you measure height in meters vs. centimeters, your covariance will change.
Correlation () solves this by dividing Covariance by the standard deviations, creating a unitless number between and .
| Value | Meaning |
|---|---|
| +1 | Perfect positive linear relationship. |
| 0 | No linear relationship (they are uncorrelated). |
| -1 | Perfect negative linear relationship. |
3. The Covariance Matrix ()
In fields like Finance and AI, we deal with vectors of random variables. We organize all their relationships into a square matrix:
In a large matrix , the diagonal represents the variances of the individual variables, and the off-diagonal entries represent the relationships between them.
Interactive Correlation Explorer
Correlation scatter plot
Adjust r and see how the cloud tightens/loosens. Toggle heteroscedasticity for cone-shaped variance.
Test Your Knowledge
Example: Calculating Covariance from a Table
Given the results from our previous example: . Calculate the Covariance .
View Step-by-Step Solution
Using the computational formula:
Since the covariance is positive, the variables move together.