Sample/Population Covariance Calculator

Calculate sample/population covariance step by step

For the given two sets of values, the calculator will find the covariance between them (either sample or population), with steps shown.

Related calculator: Correlation Coefficient Calculator

Comma-separated.
Comma-separated.

If the calculator did not compute something or you have identified an error, or you have a suggestion/feedback, please contact us.

Your Input

Find the sample covariance between {4,6,1,2,3}\left\{4, 6, 1, 2, 3\right\} and {1,4,5,3,2}\left\{1, 4, 5, 3, 2\right\}.

Solution

The sample covariance of data is given by the formula cov(x,y)=i=1n(xiμx)(yiμy)n1cov(x,y) = \frac{\sum_{i=1}^{n} \left(x_{i} - \mu_{x}\right)\cdot \left(y_{i} - \mu_{y}\right)}{n - 1}, where nn is the number of values, xi,i=1..nx_i, i=\overline{1..n} and yi,i=1..ny_i, i=\overline{1..n} are the values themselves, μx\mu_{x} is the mean of the x-values, and μy\mu_{y} is the mean of the y-values.

The mean of the x-values is μx=165\mu_{x} = \frac{16}{5} (for calculating it, see mean calculator).

The mean of the y-values is μy=3\mu_{y} = 3 (for calculating it, see mean calculator).

Since we have nn points, n=5n = 5.

The sum of (xiμx)(yiμy)\left(x_{i} - \mu_{x}\right)\cdot \left(y_{i} - \mu_{y}\right) is (4165)(13)+(6165)(43)+(1165)(53)+(2165)(33)+(3165)(23)=3.\left(4 - \frac{16}{5}\right)\cdot \left(1 - 3\right) + \left(6 - \frac{16}{5}\right)\cdot \left(4 - 3\right) + \left(1 - \frac{16}{5}\right)\cdot \left(5 - 3\right) + \left(2 - \frac{16}{5}\right)\cdot \left(3 - 3\right) + \left(3 - \frac{16}{5}\right)\cdot \left(2 - 3\right) = -3.

Thus, cov(x,y)=i=1n(xiμx)(yiμy)n1=34=34cov(x,y) = \frac{\sum_{i=1}^{n} \left(x_{i} - \mu_{x}\right)\cdot \left(y_{i} - \mu_{y}\right)}{n - 1} = \frac{-3}{4} = - \frac{3}{4}.

Answer

The sample covariance is cov(x,y)=34=0.75cov(x,y) = - \frac{3}{4} = -0.75A.