Covariance vs correlation is one of the most common points of confusion in statistics. Covariance shows whether two variables move in the same direction. Correlation shows the same thing and also tells you how strong the link is, on a fixed scale from -1 to +1.
The two measures are closely related, yet they answer different questions. Picking the wrong one can make a weak pattern look strong or hide a real one.
In this blog, we’ll define both measures, work through a survey example, and show when each one fits.
What is covariance?
Covariance is a statistic that measures how two variables change together. When one variable sits above its average at the same time the other does, covariance is positive. When one rises as the other falls, it is negative.
The sample covariance formula multiplies each pair’s deviations from the means, adds the products, and divides by n – 1:
cov(X, Y) = Σ (xᵢ – x̄)(yᵢ – ȳ) / (n – 1)
In that formula:
- xᵢ and yᵢ: Each respondent’s pair of values.
- x̄ and ȳ: The mean of each variable.
- n: The number of pairs.
Population covariance divides by n instead. Survey work usually uses the sample version, because respondents are a sample of a larger group.
Covariance carries units. If X is in dollars and Y is in years, covariance is in dollar-years. That is why its size is hard to read on its own.
How to read a covariance value
Only the sign of covariance has a universal meaning. Here is what each result tells you:
- Positive covariance: The variables tend to rise and fall together.
- Negative covariance: One variable tends to rise when the other falls.
- Covariance near zero: There is no consistent straight-line pattern.
The size of the number depends on the units. A covariance of 45 is not automatically stronger than a covariance of 4.
Positive and negative covariance examples
Everyday data show both directions clearly. Think of these two pairs:
- Positive: Hours studied and exam score. More study time tends to go with higher scores, so their covariance is positive.
- Negative: Product price and units sold. Higher prices tend to go with fewer sales, so their covariance is negative.
In both cases, the sign names the direction. Only a correlation coefficient can tell you how tight the pattern is.
What is correlation?
Correlation is a standardized measure of the direction and strength of the relationship between two variables. The most common version is the Pearson correlation coefficient, written as r. It divides covariance by the product of the two standard deviations. A standard deviation is the typical distance of values from their average.
r = cov(X, Y) / (sX × sY)
The units cancel in that division. So r has no unit and always falls between -1 and +1. A value of +1 means a perfect positive straight-line relationship. A value of -1 means a perfect negative one, and 0 means no straight-line relationship.
Pearson’s r assumes continuous data and a roughly linear pattern. Other coefficients, such as Spearman’s rank correlation, handle ranked data.
How to read a correlation coefficient
The sign gives direction and the absolute value gives strength. Rules of thumb vary by field, so treat these bands as a starting point rather than a standard.
- 0.00 to 0.19: Very weak or none.
- 0.20 to 0.39: Weak.
- 0.40 to 0.59: Moderate.
- 0.60 to 0.79: Strong.
- 0.80 to 1.00: Very strong.
Squaring r gives R-squared, the share of one variable’s variation that a straight line with the other explains. An r of 0.70 means the two variables share about 49% of their variation.
What is the difference between covariance and correlation?
The main difference is scale. Covariance has no bounds and depends on units, while correlation uses a fixed scale and has no units. Both describe linear association between two variables, and both are zero when no linear pattern exists.
| Feature | Covariance | Correlation |
|---|---|---|
| What it tells you | Direction of the relationship | Direction and strength |
| Range | Negative infinity to positive infinity | -1 to +1 |
| Units | Product of both variables’ units | None |
| Effect of rescaling | Changes with the scale | Stays the same |
| Comparing across datasets | Unreliable | Reliable |
| Typical use | Modeling, portfolio math, matrices | Reporting and interpretation |
| Link between them | Raw measure | Covariance divided by both standard deviations |
Step-by-step example: Calculating covariance and correlation
Suppose a support team surveys eight customers. Each rates support satisfaction (X) from 1 to 10 and likelihood to recommend (Y) from 0 to 10. The steps below show both measures from raw scores.
The survey data
Here are the eight paired responses:
| Respondent | Satisfaction (X) | Recommend (Y) |
|---|---|---|
| 1 | 4 | 3 |
| 2 | 5 | 5 |
| 3 | 6 | 5 |
| 4 | 7 | 7 |
| 5 | 7 | 8 |
| 6 | 8 | 8 |
| 7 | 9 | 9 |
| 8 | 10 | 10 |
Calculation steps
Follow these five steps to get both measures:
- Find the means: x̄ = 7.00 and ȳ = 6.875.
- Subtract each mean from its scores, multiply each pair, and add the products. The sum is 32.0.
- Divide by n – 1 (7). Covariance is 4.57.
- Find the standard deviations: sX = 2.00 and sY = 2.36.
- Divide covariance by their product: 4.57 / (2.00 × 2.36) = 0.97.
The positive covariance confirms the variables move together. Only the correlation tells you the link is very strong.
What happens when the units change
Now rescale satisfaction to a 0 to 100 scale by multiplying every score by 10. Covariance jumps to 45.71. Correlation stays at 0.97.
The respondents and the pattern are identical, yet covariance grew tenfold. That is why analysts compare correlations, not covariances, across surveys.
How do you convert covariance to correlation?
You convert covariance to correlation by dividing it by the product of the two standard deviations. The reverse works too, as long as you know both standard deviations.
- Covariance to correlation: r = cov(X, Y) / (sX × sY).
- Correlation to covariance: cov(X, Y) = r × sX × sY. Using the example, 0.97 × 2.00 × 2.36 = 4.57.
- Variance as a special case: The covariance of a variable with itself equals its variance, and its correlation with itself is always 1.
You cannot get correlation from covariance alone. The standard deviations carry the missing scale information.
How to calculate covariance and correlation in Python
Python computes both measures in one line each. NumPy’s np.cov returns the sample covariance matrix, and np.corrcoef returns the correlation matrix. Using the survey data from earlier:
import numpy as np
x = np.array([4, 5, 6, 7, 7, 8, 9, 10])
y = np.array([3, 5, 5, 7, 8, 8, 9, 10])
print(np.cov(x, y)[0, 1]) # 4.571
print(np.corrcoef(x, y)[0, 1]) # 0.970
Both functions return a 2 by 2 grid. The off-diagonal cell holds the value for the pair, which is why the code reads index [0, 1].
Covariance and correlation matrices
A covariance matrix is a grid that lists the covariance of every pair of variables in a dataset. A correlation matrix does the same with correlation coefficients. Both are symmetric, so the value for X and Y equals the value for Y and X.
| Matrix feature | Covariance matrix | Correlation matrix |
|---|---|---|
| Diagonal cells | Each variable’s variance | Always 1 |
| Off-diagonal cells | Covariance of each pair | Correlation of each pair |
| Units | Mixed, depends on the pair | None |
| Best for | Modeling and dimension reduction | Heatmaps and reporting |
For a hands-on look at the second type, see how a correlation matrix works with survey data.
Real-world examples of covariance and correlation
Both measures show up well beyond textbooks. Finance leans on covariance, data science uses both, and survey research relies mostly on correlation.
Portfolio risk in finance
Investors use the covariance between asset returns to estimate portfolio risk. Harry Markowitz shared the 1990 Nobel Memorial Prize in Economic Sciences for pioneering work in financial economics, including how holding assets together shapes risk.
- Low or negative covariance between assets: Combining them lowers overall volatility.
- High positive covariance: The assets fall together, so diversification adds little.
- Beta: A stock’s beta equals its covariance with the market divided by the market’s variance.
Principal component analysis
Principal component analysis (PCA) is a method that compresses many variables into a few new ones that capture the most variation. It can start from either matrix.
| Your data | Matrix to use | Reason |
|---|---|---|
| Same units and scale | Covariance matrix | Preserves real differences in spread |
| Different scales | Correlation matrix | Stops the largest-scale variable from dominating |
| Mixed survey scales (5-point and 10-point) | Correlation matrix | Puts every question on equal footing |
Survey research
Researchers correlate survey questions to see which ones move together. A team might test whether delivery-time ratings track repurchase intent. This is the core idea behind correlational research.
Key driver analysis, which ranks the factors that move overall satisfaction most, builds on the same logic. Correlation gives a fast first read on where to look.
How to choose between covariance and correlation
Choose by goal, not habit. Ask these five questions in order:
- Are you comparing relationships across variables or datasets? Use correlation.
- Do your variables sit on different scales? Use correlation, or standardize first.
- Does a model need raw variances, as in portfolio optimization or PCA on same-scale data? Use covariance.
- Are you reporting to a non-technical audience? Use correlation.
- Is your data ranked or heavily skewed? Use a rank correlation such as Spearman’s.
A simple default works for most teams. Report correlation, and keep covariance for the modeling step.
Pros and cons of covariance and correlation
Each measure has strengths that suit different jobs. Neither captures curved relationships.
Covariance
Pros:
- Simple to compute from raw data.
- Feeds directly into matrices, PCA, and portfolio models.
- Keeps the original scale information.
Cons:
- Size depends on units, so it is hard to interpret.
- Cannot be compared across datasets.
- Says nothing about strength.
Correlation
Pros:
- Standardized between -1 and +1.
- Comparable across variables and studies.
- Easy to explain to non-technical readers.
Cons:
- Detects only linear patterns.
- Sensitive to outliers.
- Does not show cause and effect.
What are the limits of correlation?
Correlation summarizes linear association only. It misleads in three predictable ways:
- Outliers can inflate or erase the coefficient.
- Curved patterns can hide a real relationship.
- Causal readings treat association as proof of cause.
Outliers
One extreme respondent can wreck a coefficient. Add a ninth customer who rates satisfaction 10 and likelihood to recommend 0 to the earlier example. The correlation drops from 0.97 to 0.25.
Always scan a scatterplot before you trust r.
Curved relationships
A perfect pattern can still produce zero. Take these values, where y = x squared:
| x | -3 | -2 | -1 | 0 | 1 | 2 | 3 |
| y | 9 | 4 | 1 | 0 | 1 | 4 | 9 |
Covariance and correlation are both exactly 0, yet y depends fully on x. Anscombe’s classic quartet makes the same point. In his 1973 paper in The American Statistician, four very different datasets share a correlation of 0.816.
Correlation is not causation
A strong coefficient shows association, not cause. Altman and Krzywinski explain in Nature Methods that correlation does not prove one variable drives the other. To test whether one variable predicts another, move to regression analysis.
What are the other types of correlation coefficients?
Pearson’s r is only one of several coefficients. The right choice depends on your data type and the shape of the relationship.
| Coefficient | Best for | Data type |
|---|---|---|
| Pearson’s r | Straight-line relationships | Continuous, roughly normal |
| Spearman’s rho | Consistent upward or downward trends, even if curved | Ordinal or ranked |
| Kendall’s tau | Smaller samples with many tied ranks | Ordinal |
Two extensions help with more than two variables. Partial correlation removes the effect of a third variable. Multiple correlation measures how well several variables together relate to one outcome.
Common mistakes when comparing covariance and correlation
Most errors come from reading numbers without context. Watch for these five:
- Reading a big covariance as a strong link. A covariance of 45 can describe a weaker pattern than a covariance of 4 if the units differ.
- Comparing covariances across surveys.
Different scales make the numbers incomparable. Compare correlations instead. - Skipping the scatterplot.
Outliers and curves hide inside a single coefficient. - Using Pearson on ranked answers.
Single rating-scale items are ordinal data, so Spearman’s rank correlation is usually safer. - Mixing up r and R-squared.
An r of 0.50 explains 25% of the variation, not 50%.
How to run correlation analysis on survey data in QuestionPro
QuestionPro’s correlation analysis feature calculates the coefficient between two numeric or ordinal questions in your results. You choose the method and read the sign and size of r directly.
- Build the survey with numeric or rating-scale questions, such as satisfaction or importance.
- Collect responses through your survey software distribution channels.
- Select the two variables you want to compare.
- Choose Pearson’s r for continuous data without major outliers, or Spearman’s rank for ordinal data.
The output is a coefficient between -1 and +1. Pair it with a scatterplot before drawing conclusions.
Covariance is the raw material and correlation is the finished measure
Covariance records how two variables move together in their original units. Correlation strips out those units so you can judge strength and compare across studies.
Keep these three habits:
- Use covariance when a model needs the raw numbers.
- Use correlation when a person needs to understand the result.
- Check both against a plot, because neither one proves cause.
Frequently Asked Questions (FAQs)
Use COVARIANCE.S for sample covariance and CORREL for the Pearson coefficient. Both take two cell ranges, such as =CORREL(A2:A9,B2:B9), so keep each X value paired with its matching Y value. Choose COVARIANCE.P only when your data covers an entire population.
Use sample covariance, which divides by n – 1. Survey respondents represent a larger group, and n – 1 corrects the small downward bias that dividing by n creates. Population covariance fits only when you measured every member of the group.
Squaring r gives R-squared, the share of one variable’s variation that a straight line with the other explains. In the survey example, r of 0.97 gives about 0.94, so roughly 94% of the variation in recommendation scores tracks satisfaction.
It is common with averaged multi-item scales, which behave more like continuous data. Single Likert items are ordinal, though, so Spearman’s rank correlation is the safer choice. Always check a scatterplot for ties and clustering first.
Partial correlation measures the relationship between two variables after removing the effect of one or more others. Use it when a third factor, such as customer tenure, might drive both satisfaction and loyalty scores and inflate the raw coefficient.



