Covariance: Definition, Formula, Types, and Examples
What is covariance?
Covariance is a statistical measure of how two random variables move together. In finance, it typically describes how the returns of two assets change in relation to one another:
– Positive covariance: the assets tend to move in the same direction.
– Negative covariance: the assets tend to move in opposite directions.
Covariance indicates direction (same or opposite movement) but not the strength of the relationship.
Formula
Sample covariance between two series X and Y (with n observations) is:
cov(X,Y) = Σ (xi − x̄)(yi − ȳ) / (n − 1)
Explore More Resources
where xi and yi are individual observations and x̄ and ȳ are the sample means. (For a population covariance, divide by n instead of n − 1.)
How to calculate (step-by-step)
- Compute the return (or observation) series for each variable.
- Calculate the mean of each series.
- For each paired observation, compute the deviation from its mean: (xi − x̄) and (yi − ȳ).
- Multiply these deviations for each pair and sum the products: Σ (xi − x̄)(yi − ȳ).
- Divide the sum by (n − 1) to get the sample covariance.
Example
Given four daily returns (percent):
– ABC: 1.2, 1.8, 2.2, 1.5 (mean = 1.675%)
– XYZ: 3.1, 4.2, 5.0, 4.2 (mean = 4.125%)
Explore More Resources
Compute deviations, multiply pairwise, sum the products = 0.943.
Divide by n − 1 (4 − 1 = 3): cov = 0.943 / 3 ≈ 0.314
Interpretation: cov ≈ 0.314 (positive) — the two stocks tended to move together over this period.
Explore More Resources
Interpreting covariance
- Sign: indicates direction (positive = same direction, negative = opposite).
- Magnitude: depends on the units of the variables (e.g., percent × percent), so raw magnitude is not directly comparable across different scales.
- Zero covariance: no linear directional relationship; high values of one variable are not systematically paired with high or low values of the other.
Covariance vs. variance vs. correlation
- Variance measures dispersion of a single variable around its mean: var(X) = cov(X, X).
- Covariance measures directional co-movement between two variables.
- Correlation standardizes covariance to a unitless measure of strength:
correlation r = cov(X,Y) / (σX σY), with r ∈ [−1, +1].
Correlation conveys both direction and strength; covariance only gives direction and scale-dependent magnitude.
Applications in finance
- Portfolio construction: covariance between assets is central to diversification and portfolio variance. Combining assets with low or negative covariance reduces overall portfolio volatility.
- Capital Asset Pricing Model (CAPM): beta is derived from covariance: β = cov(asset, market) / var(market). Beta measures an asset’s systematic risk relative to the market.
- Risk management and asset allocation: covariance matrices are used to compute portfolio risk and to optimize allocations under Modern Portfolio Theory (MPT).
Key takeaways
- Covariance shows whether two variables tend to move together or oppositely, but not how strongly.
- Use correlation to assess strength; use covariance (or a covariance matrix) when computing portfolio variance and deriving measures like beta.
- For practical diversification, prefer assets with low or negative covariance to reduce portfolio risk.
Bottom line
Covariance is a fundamental statistical tool in finance for assessing directional relationships between asset returns and for building diversified portfolios. It should be interpreted together with variance and correlation to make informed investment and risk-management decisions.