Advertisement

Covariance calculator

Measure whether two quantities tend to lie above or below their means together. Keep paired values in the same order.

Calculator

Use commas, spaces or new lines between numbers. Use the same unit for every observation.

Use commas, spaces or new lines between numbers. Use the same unit for every observation.

Covariance
1.000000
Mean x
2.000000
Mean y
3.333333
Pair count
3.000000
Centred cross-products
xy(x - meanX)(y - meanY)
1.0000002.0000001.333333
2.0000004.0000000.000000
3.0000004.0000000.666667

Advertisement

How this calculator works

Each cross-product combines the deviations of a paired x and y from their respective means. Same-sign deviations add positively; opposite signs add negatively. Divide the total by n for a whole population or by n - 1 for a sample estimate. Covariance has compound units, such as kilograms times metres, so its magnitude depends on the scales used.

Formula

Covpopulation = Σ((x - meanX)(y - meanY))/n; Covsample uses n - 1. With consistent summaries, Cov = r × SDx × SDy.

Worked example

For x = 1, 2, 3 and y = 2, 4, 4, the centred cross-products sum to 2. The sample covariance is 1 and the population covariance is 2/3.

Advertisement

Frequently asked questions

Why is covariance not limited to -1 and 1?

It retains the scales and units of both variables. Correlation divides out their standard deviations.

May one variable be constant?

Yes. Its deviations are zero, so covariance is zero. A corresponding correlation is undefined.

Which standard deviations should I enter?

Use standard deviations and correlation calculated from the same data with consistent sample or population conventions.

Sources

Advertisement