What is covariance and what does it tell you about two variables?+
Covariance tells you whether two variables tend to move together or apart. A positive covariance means that above-average values of X tend to pair with above-average values of Y. A negative covariance means they move in opposite directions. A covariance near zero suggests no consistent linear relationship. The raw number is hard to interpret without context because it depends on the units of measurement.
What is the formula for sample covariance?+
Sample covariance is Cov(X,Y) = Sum((xi - x-mean)(yi - y-mean)) / (n-1). The n-1 in the denominator (Bessel correction) produces an unbiased estimate of the true population covariance from a sample. The equivalent computational formula is Cov(X,Y) = (n*SumXY - SumX*SumY) / (n*(n-1)), which can be more numerically stable for large datasets.
When should I use sample covariance vs population covariance?+
Use sample covariance (n-1 denominator) when your data is a sample drawn from a larger population. This is the most common case in practice: survey data, experiment results, historical price data for a period. Use population covariance (n denominator) only when your data covers the entire population with no sampling involved, such as the grades of every student in a specific class with no intent to generalize beyond that class.
How is covariance different from the correlation coefficient?+
Covariance and correlation both measure the linear relationship between two variables, but correlation is dimensionless and bounded between -1 and +1. The Pearson correlation r = Cov(X,Y) / (Sx * Sy), where Sx and Sy are the standard deviations of X and Y. Dividing by the SDs removes the influence of measurement scale. A covariance of 500 (cm*kg) is difficult to interpret and cannot be compared to a covariance of 0.003 (m*ton), but r can be compared directly across datasets.
Can covariance be greater than 1 or less than -1?+
Yes. Unlike the correlation coefficient, covariance has no fixed bounds. It can be any real number, positive or negative, including values with very large absolute magnitudes. For example, if X is in millions of dollars and Y is also in millions of dollars, covariance will be in units of millions-squared. This is why comparing raw covariance values across different datasets or variable scales is meaningless without normalisation.
What does zero covariance mean?+
Zero covariance means there is no linear relationship between X and Y. However, it does not mean the variables are statistically independent. A classic counterexample: if Y = X squared and the X values are symmetric around zero (e.g. -2, -1, 0, 1, 2), the covariance is exactly zero even though Y is completely determined by X. Independence implies zero covariance, but zero covariance does not imply independence.
How is covariance used in portfolio theory?+
In Markowitz portfolio theory, the variance of a two-asset portfolio is Var(P) = w1^2 * Var(X) + w2^2 * Var(Y) + 2 * w1 * w2 * Cov(X, Y). A negative or low covariance between two assets reduces overall portfolio variance. This is the mathematical foundation of diversification: mixing assets with different return patterns (low or negative covariance) lowers risk without necessarily lowering expected return.
What is a covariance matrix and how is it used?+
A covariance matrix is a square matrix where entry (i, j) is the covariance between variable i and variable j. The diagonal entries are the variances (each variable's covariance with itself). The matrix is always symmetric. Covariance matrices are central to multivariate statistics, including principal component analysis (PCA), linear discriminant analysis (LDA), Gaussian mixture models, and Kalman filters for tracking and prediction.
Is covariance affected by outliers?+
Yes, covariance is sensitive to outliers. A single extreme pair (xi, yi) with large deviations from both means can dominate the sum of cross-products and substantially shift the covariance value. If you suspect outliers, inspect a scatter plot first and consider whether to include or exclude the extreme points. Robust alternatives include Spearman correlation (rank-based) or trimmed covariance estimators.
Why does the deviation product table show five columns?+
The five columns are: x (each X value), y (each Y value), (x - x-mean) (deviation of X from its mean), (y - y-mean) (deviation of Y from its mean), and their product (x - x-mean)(y - y-mean). Summing the last column gives the total sum of cross-deviations. Dividing by n-1 gives sample covariance. This step-by-step breakdown is useful for understanding the formula, checking manual calculations, and explaining results in reports or homework.
How do I interpret the Sum of Products shown in the results?+
The Sum of Products (shown as Sum of cross-deviations) is the raw numerator before dividing by n-1 or n. It equals Sum((xi - x-mean)(yi - y-mean)). This is the total joint deviation across all pairs. Dividing by n-1 gives sample covariance; dividing by n gives population covariance. The Sum of Products itself is useful in regression calculations and in multi-variable analyses where you need intermediate statistics.