vcconv {lme4} | R Documentation

## Convert between representations of (co-)variance structures

### Description

Convert between representations of (co-)variance structures (EXPERIMENTAL). See source code for details.

### Usage

      mlist2vec(L)
      vec2mlist(v, n = NULL, symm = TRUE)
      vec2STlist(v, n = NULL)
      sdcor2cov(m)
      cov2sdcor(V)
      Vv_to_Cv(v, n = NULL, s = 1)
      Sv_to_Cv(v, n = NULL, s = 1)
      Cv_to_Vv(v, n = NULL, s = 1)
      Cv_to_Sv(v, n = NULL, s = 1)

### Arguments

`L` | List of symmetric, upper-triangular, or lower-triangular square matrices.
`v` | Concatenated vector containing the elements of the lower-triangle (including the diagonal) of a symmetric or triangular matrix.
`n` | Number of rows (and columns) of the resulting matrix.
`symm` | Return symmetric matrix if `TRUE` or lower-triangular if `FALSE`.
`m` | Standard deviation-correlation matrix.
`V` | Covariance matrix.
`s` | Scale parameter.

### Details

- `mlist2vec`Convert list of matrices to concatenated vector of lower triangles with an attribute that gives the dimension of each matrix in the original list. This attribute may be used to reconstruct the matrices. Returns a concatenation of the elements in one triangle of each matrix. An attribute `"clen"` gives the dimension of each matrix.

- `vec2mlist`Convert concatenated vector to list of matrices (lower triangle or symmetric). These matrices could represent Cholesky factors, covariance matrices, or correlation matrices (with standard deviations on the diagonal).

- `vec2STlist`Convert concatenated vector to list of ST matrices.

- `sdcor2cov`Standard deviation-correlation matrix to covariance matrix convert 'sdcor' format (std dev on diagonal, cor on off-diag) to and from variance-covariance matrix.

- `cov2sdcor`Covariance matrix to standard deviation-correlation matrix (i.e. standard deviations on the diagonal and correlations off the diagonal).

- `Vv_to_Cv`Variance-covariance to relative covariance factor. Returns a vector of elements from the lower triangle of a relative covariance factor.

- `Sv_to_Cv`Standard-deviation-correlation to relative covariance factor. Returns a vector of elements from the lower triangle of a relative covariance factor.

- `Cv_to_Vv`Relative covariance factor to variance-covariance. From unscaled Cholesky vector to (possibly scaled) variance-covariance vector. Returns a vector of elements from the lower triangle of a variance-covariance matrix.

- `Cv_to_Sv`Relative covariance factor to standard-deviation-correlation. From unscaled Chol to sd-cor vector. Returns a vector of elements from the lower triangle of a standard-deviation-correlation matrix.

### Value

(Co-)variance structure

### Examples

    vec2mlist(1:6)
    mlist2vec(vec2mlist(1:6)) # approximate inverse

[Package lme4 version 1.1-11 Index]