Covariance Calculator

Online calculator for calculating the covariance of two data series


On this page the covariance of two sorted lists is calculated.

To perform the calculation, enter series of numbers. Then click the 'Calculate' button. The list can be entered unsorted.


Input format

The data can be entered as a series of numbers, separated by semicolons or spaces. You can enter the data as a list (one value per line). Or from a column from Excel spreadsheet by copy & paste


Covariance calculator

Input
Decimal places
  Results
Entire set
Sample

Covariance is a measure of the linear relationship between two statistical variables.

The covariance can be determined as a sample covariance for a subset, or for the entire set. Different formulas apply for total quantity or sample.


Empirical covariance Formulas

To calculate the covariance of a sample

\(\displaystyle cov(x,y)=\frac{1}{n-1} \left( \sum^n_{i=1} (x_i-\overline{x})(x_i-\overline{y}) \right) \)

Covariance

To calculate the covariance of a total quantity

\(\displaystyle cov(x,y)=\frac{1}{n} \left( \sum^n_{i=1} (x_i-\overline{x})(x_i-\overline{y}) \right) \)

\(n\) Number of data points
\(x_i\) Single value of x
\(\overline{x}\) Mean of x
\(y_i\) Single value of y
\(\overline{y}\) Mean of y

Example


In the example we assume that a number of carpenters make a certain number of chairs per day

3 carpenters: 10 chairs
5 carpenters: 16 chairs
7 carpenters: 22 chairs

First, the arithmetic mean is calculated from the number of workers and the number of chairs.

\(\displaystyle 3+4+7=\frac{15}{3}=\color{#44F}{5}\)

\(\displaystyle 10+16+22=\frac{48}{3}=\color{#44F}{16}\)

Calculate covariance:

\(\displaystyle cov(x,y)= ((x_1-\overline{x}) · (y_1-\overline{y})\) \(\displaystyle +(x_2-\overline{x}) · (y_2-\overline{y})\) \(\displaystyle +(x_3-\overline{x}) · (y_3-\overline{y})) \)

\(\displaystyle cov(x,y)= ((3-5) · (10-16)\) \(\displaystyle +(5-5) · (16-16)\) \(\displaystyle +(7-5) · (22-16)) \)

\(\displaystyle = (-2 · -6) +(0 ·0) +(2 · 6) \)

\(\displaystyle = 12 +0 +12 =24 \)

\(\displaystyle = \frac{24}{3}=\color{#44F}{8} \)

In the case of a sample (empirical covariance), divide by \(n-1\) instead of \(n\). In the example above, divide by 2.



More statistics functions

Arithmetic MeanContraharmonic MeanCovarianceEmpirical distribution CDFDeviationFive-Number SummaryGeometric MeanHarmonic MeanInverse Empirical distribution CDFKurtosisLog Geometric MeanLower QuartileMedianPooled Standard DeviationPooled VarianceSkewness (Statistische Schiefe)Upper QuartileVariance




Is this page helpful?            
Thank you for your feedback!

Sorry about that

How can we improve it?