Covariance

| Main Article
| Discussion
| Related Articles  [?]
| Bibliography  [?]
| External Links  [?]
| Citable Version  [?]

|
|
|
|
|
|
|
|

This editable Main Article has an approved citable version (see its Citable Version subpage). While we have done conscientious work, we cannot guarantee that this Main Article, or its citable version, is wholly free of mistakes. By helping to improve this editable Main Article, you will help the process of generating a new, improved citable version.

[edit intro]

## Contents

* 1 Formal definition
* 2 Finite data
* 3 Unbiased estimate
* 4 Properties

The covariance -- usually denoted as Cov -- is a statistical parameter used to compare two real random variables on the same sample space (more precisely, the same probability space).
It is defined as the expectation (or mean value) of the product of the deviations (from their respective mean values) of the two variables.

The sign of the covariance indicates a linear trend between the two variables.

* If one variable increases (in the mean) with the other, then the covariance is positive.
* It is negative if one variable tends to decrease when the other increases.
* If it is 0 then there is no linear correlation between the two variables.
In particular, this is the case for stochastically independent variables. But the inverse is not true because there may still be other - nonlinear - dependencies.

The value of the covariance is scale-dependent and therefore does not show how strong the correlation is. For this purpose a normed version of the covariance is used -- the correlation coefficient which is independent of scale.

## Formal definition[edit]

The covariance of two real random variables X and Y with expectation (mean value)

E(X)=μXandE(Y)=μY

is defined by

Cov⁡(X,Y):=E((X−μX)(Y−μY))=E(XY)−E(X)E(Y)

Remark:
If the two random variables are the same then their covariance is equal to the variance of the single variable: Cov(X,X) = Var(X).

In a more general context of probability theory the covariance is a second-order central moment of the two-dimensional random variable (X,Y), often denoted as μ11.

## Finite data[edit]

For a finite set of data

(xi,yi)∈ℝ2 with i=1,…,n

the covariance is given by

1n∑i=1n(xi−x‾)(yi−y‾)where x‾:=1n∑i=1nxi and y‾:=1n∑i=1nyi

or, using a convenient notation

[ai]:=∑i=1nai

introduced by Gauss, by

1n([xiyi]−[xi][yi])

This is equivalent to taking the uniform distribution where each item (xi,yi) has probability 1/n.

## Unbiased estimate[edit]

The expectation of the covariance of a random sample -- taken from a probability distribution -- depends on the size n of the sample and is slightly smaller than the covariance of the distribution.

An unbiased estimate of the covariance is

Cov(X,Y)=nn−1Cov(xi,yi)=1n−1∑i=1n(xi−x‾)(yi−y‾)

Remark:
The distinction between the covariance of a sample and the estimated covariance of the distribution is not always clearly made. This explains why one finds both formulae for the covariance -- that taking the mean with " 1 / n " and that with " 1 / (n-1) " instead.

## Properties[edit]

The covariance is

* (1) symmetric
* (2) bilinear
* (3) positive definite

because the following holds:

(1) Cov⁡(X,Y)=Cov⁡(Y,X)

(2a)Cov⁡(aX1+bX2,Y)=a⋅Cov⁡(X1,Y)+b⋅Cov⁡(X2,Y)

(2b)Cov⁡(X,aY1+bY2)=a⋅Cov⁡(X,Y1)+b⋅Cov⁡(X,Y2)

(3) Cov⁡(X,X)≥0andCov⁡(X,X)=0⇔X=μX almost surely

Since the covariance cannot distinguish between random variables X1 and X2 that have the same deviation, (i.e., X1 − E(X1) = X2 − E(X2) holds almost surely) it does not define an inner product for random variables, but only for random variables with mean 0 or, equivalently, for the deviations.