TableOfReal: To Covariance

A command that creates a Covariance object from every selected TableOfReal object. The covariances are calculated between columns.


The covariance coefficients sij between the elements of columns i and j are defined as:

sij = Σk (xki - x̄i)(xkj - x̄j)/(numberOfObservations - numberOfConstraints),

where xki is the element k in column i, x̄i is the mean of column i, numberOfObservations equals the number of rows in the table, and numberOfConstraints equals 1.

The actual calculation goes as follows

1. Centralize each column (subtract the mean).
2. Get its singular value decomposition U Σ V′.
3. Form S = V Σ V′.
4. Divide all elements in S by (numberOfObservations - 1).

Links to this page

© djmw, December 9, 2015