cov2theta function

Compute a Packed Representation of a Covariance Matrix

Compute a Packed Representation of a Covariance Matrix

Transform covariances matrices to a packed representation or compute the inverse transformation.

cov2theta(Sigma) theta2cov(theta)

Arguments

  • Sigma: an nn-by-nn real, symmetric positive definite matrix. Only the upper triangle is seen .
  • theta: a numeric vector of length n(n+1)/2n*(n+1)/2 whose first nn elements are positive.

Returns

A vector like theta (cov2theta) or a matrix like Sigma (theta2cov); see Details .

Details

An nn-by-nn real, symmetric, positive definite matrix Σ\Sigma can be factorized as

Σ=RR.Sigma=RR. \Sigma = R' R\,.Sigma = R' * R .

The upper triangular Cholesky factor RR can be written as

R=R1D1/2Dσ1/2,R=R1/sqrt(D)sqrt(Ds), R = R_{1} D^{-1/2} D_{\sigma}^{1/2}\,,R = R1 / sqrt(D) * sqrt(Ds) ,

where R1R1 is a unit upper triangular matrix and D=diag(diag(R1R1))D = diag(diag(R1' * R1))

and Ds=diag(diag(Sigma))Ds = diag(diag(Sigma))

are diagonal matrices.

cov2theta takes Σ\Sigma and returns the vector θ\theta

of length n(n+1)/2n*(n+1)/2 containing the log diagonal entries of DσD_{\sigma} followed by (in column-major order) the strictly upper triangular entries of R1R_{1}. theta2cov computes the inverse transformation.