Covariance and Correlation Calculator

Covariance is a measure of how two random variables change together. For paired data (X, Y), if the values of Y tend to increase as the values of X increase, the covariance will be positive. If Y tends to decrease as X increases, covariance is negative. The correlation coefficient r (also called Pearson's correlation coefficient) indicates the strength of the relationship. When |r| is close to the 1, there is a strong linear relation between X and Y. See calculator and equations below.

Enter paired data as shown in the input field on the left; you can enter as many points as necessary. Do not end the list with a comma.



Covariance Formula

Given a set of paired X and Y data {(Xi, Yi)}i = 1...n, the covariance of X and Y is

Covariance(X,Y) = (1/n)Σ (Xi - μX)(Yi - μY)

where μX and μY are the population means of X and Y respectively. If μX and μX are replaced by the sample mean of X and Y, then the sample covariance is

Sample Covariance(X,Y) = (1/(n-1))Σ (Xi - x)(Yi - y)

where x and y are the sample mean of X and Y respectively. These equations are analogous to the equations for variance and sample variance:

Var(X) = Cov(X,X) = (1/n)Σ (Xi - μX

Var(Y) = Cov(Y,Y) = (1/n)Σ (Yi - μY

Samp. Var(X) = Samp. Cov(X,X) = (1/(n-1))Σ (Xi - x

Samp. Var(Y) = Samp. Cov(Y,Y) = (1/(n-1))Σ (Yi - y

Pearson's Correlation Coefficient

Pearson's correlation coefficient is a normalized measure of covariance that ranges from -1 to 1. Values at the extreme end indicate a strong linear relation between the two variables. The expression for the correlation coefficient is

r = Cov(X,Y)/√Var(X)Var(Y)


© Had2Know 2010