Covariance Matrix

Shipping
array_covariance

Covariance matrix of a data matrix (columns = variables), with sample/population DOF control

Signature

Inputs

  • aMatrixrequiredA 2-D matrix; each COLUMN is a variable, each ROW an observation. Non-2-D input is rejected.

Outputs

  • covarianceMatrixSymmetric $k\times k$ covariance matrix; diagonal holds per-variable variances.

Parameters

KeyTypeDefaultNotes
ddofint1Delta degrees of freedom in the normalizer $N-\text{ddof}$: $1$ = sample covariance (unbiased), $0$ = population covariance.

Description

Covariance Matrix takes a 2-D matrix whose columns are variables and returns the symmetric covariance matrix , where measures how columns and vary together and the diagonal holds each variable's variance. Unlike correlation, covariance retains the variables' units ( has units of ), so magnitudes matter.

The ddof (delta degrees of freedom) parameter controls the normalizer : the default gives the sample (unbiased, Bessel-corrected) covariance, while gives the population covariance. The node requires a rank-2 input and is stateless.

Mathematics

Examples

Sample vs population variance

For a single column : with ddof = 1 the diagonal variance is ; with ddof = 0 it is .

Applications

  • Estimating the covariance structure feeding PCA, whitening, or Mahalanobis distances.
  • Propagating multivariate uncertainty through downstream linear transforms.
  • Comparing sample vs population spread by toggling ddof.

Neat

The default ddof of $1$ applies Bessel's correction, so the diagonal matches the unbiased sample variance you would get from Array Summary on each column.

Covariance keeps physical units, so the diagonal is directly readable as per-channel variance in the data's own squared units.

See also

covariancematrixmultivariateddofstateless