Covariance

Covariance is an extension of variance.


Description

Covariance is usually notated as Cov(X,Y) or σX,Y. It is an extension of variance in the sense that Var(X) = Cov(X,X). More generally, given random variables X and Y, their covariance is formulated as Cov(X,Y) = E[(X - E[X])(Y - E[Y])].

The variance of a random vector (of size n x 1) is a covariance matrix (of size n x n), usually notated as Σ. Each cell is equal to σi,j, where if i = j then σi,j = σi2.

Properties in Bivariate Case

In the bivariate case, given random variables X and Y, adding constants to either random variable does not change the covariance. Cov(X+a,Y+b) = Cov(X,Y).

Covariance also linearly scales with constant factors:

Recall that Var[aX] = a2 Var[X]. Because both variables are scaled by a, the (co)variance is linearly scaled by a twice.

Properties in Multivariate Case

Consider now the case of a random vector X of size n x 1. Adding a constant vector does not change the covariance matrix. Var[X + b] = Var[X].

Multiplying the random vector by a constant factor scales the known variance by the square of the factor. Succinctly: Var[aX] = a2 Var[X].

Similarly, let A be a constant matrix of size m x n representing a linear transformation. It follows that Var[AX] = A Var[X] AT.

A covariance matrix is necessarily square, symmetric, and positive semi-definite. It follows that:

Estimation

When working with a set of paired observations X and Y, where for each observation i there are observed values xi and yi, sample covariance is calculated as:

samp.svg

When working with a random vector x, with μ as the corresponding mean vector, the sample covariance matrix is calculated as:

sampmat.svg


Formulation

Covariance is an expected value:

exp1.svg

By expanding terms and spreading the expected value function, a simpler formula is derived. Note that expectations are linear (i.e., E[a + b] = E[a] + E[b]) and that the expected value of an expected value is the expected value itself (i.e., E[E[a]] = E[a], so also E[E[a]b] = E[a]E[b]).

exp2.svg

In terms of a random vector x, the covariance matrix is usually expressed as:

exp3.svg


CategoryRicottone

Analysis/Covariance (last edited 2026-08-12 13:42:08 by DominicRicottone)