Learn R Programming

epigrowthfit (version 0.15.4)

cov2theta: Compute a Packed Representation of a Covariance Matrix

Description

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

Usage

cov2theta(Sigma)
theta2cov(theta)

Value

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

Arguments

Sigma

an \(n\)-by-\(n\) real, symmetric positive definite matrix. Only the upper triangle is “seen”.

theta

a numeric vector of length \(n(n+1)/2\) whose first \(n\) elements are positive.

Details

An \(n\)-by-\(n\) real, symmetric, positive definite matrix \(\Sigma\) can be factorized as $$\Sigma = R' R\,.$$ The upper triangular Cholesky factor \(R\) can be written as $$R = R_{1} D^{-1/2} D_{\sigma}^{1/2}\,,$$ where \(R_{1}\) is a unit upper triangular matrix and \(D = \mathrm{diag}(\mathrm{diag}(R_{1}' R_{1}))\) and \(D_{\sigma} = \mathrm{diag}(\mathrm{diag}(\Sigma))\) are diagonal matrices.

cov2theta takes \(\Sigma\) and returns the vector \(\theta\) of length \(n(n+1)/2\) containing the log diagonal entries of \(D_{\sigma}\) followed by (in column-major order) the strictly upper triangular entries of \(R_{1}\). theta2cov computes the inverse transformation.