Covariance: Difference between revisions

From Citizendium
Jump to navigation Jump to search
imported>Peter Schmitt
m (remove a comment)
imported>John Stephenson
m (moved Covariance/Draft to Covariance: citable version policy)
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{subpages}}
{{subpages}} {{TOC|right}}


The '''covariance''' — usually denoted as '''Cov''' — is a statistical parameter used to compare
The '''covariance''' — usually denoted as '''Cov''' — is a statistical parameter used to compare
two real [[random variable]]s on the same sample space.
two real [[random variable]]s on the same sample space (more precisely, the same [[probability space]]).
<br>
<br>
It is defined as the [[expectation]] (or mean value)
It is defined as the [[expectation]] (or mean value)
Line 8: Line 8:
of the two variables.
of the two variables.


The value of the covariance depends on how clearly a linear trend is pronounced.
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.
* If one variable increases (in the mean) with the other, then the covariance is positive.
* It is negative if one variable decreases when the other one tends to increase.
* It is negative if one variable tends to decrease when the other increases.
* And it is 0 if the two variables are (stochastically) independent of each other.
* If it is 0 then there is no linear correlation between the two variables.<br> In particular, this is the case for stochastically independent variables. But the inverse is not true because there may still be other &ndash; nonlinear &ndash; dependencies.
To see how distinct the trend is, and
The value of the covariance is scale-dependent and therefore does not show how strong the correlation is.
for comparisons that are independent of the scale used,
For this purpose a normed version of the covariance is used
the normed version of the covariance &mdash; the [[correlation coefficient]] &mdash;
&mdash; the [[correlation coefficient]] which is independent of scale.
has to be used.


== Formal definition ==
== Formal definition ==


The covariance of two real random variables ''X'' and ''Y''
The covariance of two real random variables ''X'' and ''Y''
: <math> X \quad\text{and}\quad Y </math>
with expectation (mean value)
with expectation (mean value)
: <math> \mathrm E(X) = \mu_X \quad\text{and}\quad \mathrm E(Y) = \mu_Y </math>
: <math> \mathrm E(X) = \mu_X \quad\text{and}\quad \mathrm E(Y) = \mu_Y </math>
Line 31: Line 29:
If the two random variables are the same then
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'').
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 (probability theory)|moment]]
of the two-dimensional random variable (''X'',''Y''),
often denoted as &mu;<sub>11</sub>.
== Finite data ==
For a finite set of data
: <math> (x_i,y_i) \in \R^2 \ \text{with}\ i=1,\dots,n </math>
the covariance is given by
: <math> {1\over n} \sum_{i=1}^n ( x_i - \overline{x} ) ( y_i - \overline{y} )
        \qquad \text{where}\ \overline{x} := {1\over n} \sum_{i=1}^n x_i
        \ \text{and}\ \overline{y} := {1\over n} \sum_{i=1}^n y_i
  </math>
or, using a convenient notation
: <math> [a_i] := \sum_{i=1}^n  a_i </math>
introduced by [[Carl Friedrich Gauß|Gauss]], by
: <math> {1\over n}( [ x_i y_i ] - [x_i][y_i] ) </math>
This is equivalent to taking the uniform distribution
where each item (''x''<sub>''i''</sub>,''y''<sub>''i''</sub>)
has probability 1/''n''.
== Unbiased estimate ==
The expectation of the covariance of a random sample &mdash;
taken from a probability distribution &mdash; depends on the size ''n'' of the sample
and is slightly smaller than the covariance of the distribution.
An unbiased [[estimate (statistics)|estimate]] of the covariance is
: <math>  \mathrm{Cov} (X,Y) = {n \over n-1} \mathrm{Cov}(x_i,y_i)
  = {1\over n-1} \sum_{i=1}^n ( x_i - \overline{x} ) ( y_i - \overline{y} )
</math>
'''Remark:''' <br>
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
&mdash; that taking the mean with {{nowrap|" 1 / ''n'' "}} and that with {{nowrap|" 1 / (''n''-1) "}} instead.
== Properties ==
The covariance is
* (1) symmetric
* (2) bilinear
* (3) positive definite
because the following holds:
: <math> \text{(1)}\ \qquad \operatorname{Cov} (X,Y) = \operatorname{Cov} (Y,X) </math>
: <math> \text{(2a)} \qquad \operatorname{Cov} (aX_1+bX_2,Y) =
      a \cdot \operatorname{Cov} (X_1,Y) + b \cdot \operatorname{Cov} (X_2,Y)
  </math>
: <math> \text{(2b)} \qquad \operatorname{Cov} (X,aY_1+bY_2) =
      a \cdot \operatorname{Cov} (X,Y_1) + b \cdot \operatorname{Cov} (X,Y_2)
  </math>
: <math> \text{(3)}\ \qquad
        \operatorname{Cov} (X,X) \ge 0 \qquad \text{and} \qquad
        \operatorname{Cov} (X,X) = 0 \Leftrightarrow X = \mu_X \ \text{almost surely}
  </math>
Since the covariance cannot distinguish between random variables ''X''<sub>1</sub> and ''X''<sub>2</sub> that have the same deviation,
(i.e., ''X''<sub>1</sub> &minus; E(''X''<sub>1</sub>) = ''X''<sub>2</sub> &minus; E(''X''<sub>2</sub>) 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.

Revision as of 17:28, 25 August 2013

This article has a Citable Version.
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.

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

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

is defined by

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

For a finite set of data

the covariance is given by

or, using a convenient notation

introduced by Gauss, by

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

Unbiased estimate

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

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

The covariance is

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

because the following holds:

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.