Skip to content
FiftyCalc Free calculators for all 50 states

Covariance Calculator

Test cases replayed : 3 of 3 match · Methodology · No outside source listed

Paste two lists of paired values, x and y, in the same order to measure how they vary together.

Result

Sample figures

Sample covariance—

Population covariance —

  • Pearson correlation coefficient (r)—
  • Number of pairs—
  • Note—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Covariance Calculator

x values (separated by commas, spaces or new lines): type or paste your values. Prefilled example: 2, 4, 6, 8, 10.

y values, same order and count: type or paste your values. Prefilled example: 1, 3, 2, 5, 4.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. x values (separated by commas, spaces or new lines): type or paste your values.
  2. y values, same order and count: type or paste your values.
  3. Read the result: Sample covariance; the panel also shows Population covariance, Pearson correlation coefficient (r), Number of pairs and Note.

How this calculator works

Sample covariance = Σ(xᵢ − x̄)(yᵢ − ȳ) ÷ (n − 1), where x̄ and ȳ are the means of the two lists and n is the number of pairs. Population covariance divides the same sum by n.

A positive covariance means the two variables tend to rise together, a negative one that one rises when the other falls. Its size depends on the units, so the correlation r = covariance ÷ (sₓ × s_y), which is unit-free and lies between −1 and 1, is shown as well.

Worked example

x values (separated by commas, spaces or new lines)2, 4, 6, 8, 10
y values, same order and count1, 3, 2, 5, 4
Sample covariance4
Population covariance3.2
Pearson correlation coefficient (r)0.8
Number of pairs5

Frequently asked questions

What is the covariance of x = 2, 4, 6, 8, 10 and y = 1, 3, 2, 5, 4?

The means are 6 and 3, the cross-products of deviations add up to 16, so the sample covariance is 16 ÷ 4 = 4 and the population covariance 16 ÷ 5 = 3.2.

What is the difference between covariance and correlation?

Covariance is in the product of the two units and has no fixed range. Correlation divides it by both standard deviations, giving a number between −1 and 1 that can be compared across data sets.

Questions answered

Related calculators