Learn R Programming

lme4 (version 1.1-13)

vcconv: 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.

Value

(Co-)variance structure

Details

  • mlist2vecConvert 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.
  • vec2mlistConvert 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).
  • vec2STlistConvert concatenated vector to list of ST matrices.
  • sdcor2covStandard deviation-correlation matrix to covariance matrix convert 'sdcor' format (std dev on diagonal, cor on off-diag) to and from variance-covariance matrix.
  • cov2sdcorCovariance matrix to standard deviation-correlation matrix (i.e. standard deviations on the diagonal and correlations off the diagonal).
  • Vv_to_CvVariance-covariance to relative covariance factor. Returns a vector of elements from the lower triangle of a relative covariance factor.
  • Sv_to_CvStandard-deviation-correlation to relative covariance factor. Returns a vector of elements from the lower triangle of a relative covariance factor.
  • Cv_to_VvRelative 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_SvRelative 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.

Examples

Run this code
vec2mlist(1:6)
mlist2vec(vec2mlist(1:6)) # approximate inverse

Run the code above in your browser using DataLab