Advertisement

📈 Covariance Calculator

Calculate sample covariance, population covariance, and Pearson correlation coefficient for two paired datasets X and Y.

Covariance & Correlation Formulas

Sample Covariance
Cov(X,Y) = Σ(xᵢ − x̄)(yᵢ − ȳ) / (n − 1)
Population Covariance
σ_XY = Σ(xᵢ − μx)(yᵢ − μy) / n
Pearson Correlation
r = Cov(X,Y) / (s_x × s_y)

Frequently Asked Questions

Covariance measures the direction of the linear relationship between two variables. A positive covariance means both variables tend to increase together; negative means one increases as the other decreases. The magnitude is hard to interpret without standardisation.

Correlation is a standardised version of covariance. The Pearson correlation coefficient r is always between −1 and +1, making it easier to interpret. r = Cov(X,Y) / (σ_x × σ_y).

r = 1 indicates a perfect positive linear relationship; r = −1 a perfect negative linear relationship. r = 0 suggests no linear relationship. Values close to ±1 indicate a strong linear relationship.

Sample covariance divides by n−1 (Bessel's correction) to obtain an unbiased estimator of the population covariance. Use sample covariance when your data is a sample from a larger population.

No. Correlation measures linear association, not causation. Two variables may correlate because of a common cause (confounding variable), reverse causation, or pure coincidence. Always consider the context and design of the study.

Related Calculators