corr_matrix: Recovering a Symmetric Matrix from Its Lower Triangular...

View source: R/varbeta.R

corr_matrixR Documentation

Recovering a Symmetric Matrix from Its Lower Triangular Matrix

Description

This function recovers a symmetric matrix from the vector consisting of its lower triangular elements.

Usage

corr_matrix(lower.tri.vector, diag = TRUE)

Arguments

lower.tri.vector

a numerical vector containing the lower triangular elements of the symmetric matrix.

diag

a logical indicator, TRUE or FALSE, indicating if lower.tri.vector contains diagonal elements of the symmetric matrix or not.

Details

diag = FALSE is the case where a correlation matrix whose diagonal elements are 1, therefore there is no need in storing the diagonal elements.

Value

The function corr_matrix returns the original symmetric matrix. We only use diag = FALSE to recover the correlation matrix, because diagonal elements of a correlation matrix are all 1, so there is no reason to store these diagonal elements in this case.

Author(s)

Yet Nguyen ynguyen@odu.edu

References

Yet Nguyen, Dan Nettleton, 2019. rmRNAseq: RNA-seq Analysis for Repeated-measures Data

Examples


set.seed(1)
lower.tri.vector <- runif(10)
varout <- rmRNAseq:::corr_matrix(lower.tri.vector, diag=TRUE)
varout


ntyet/rmRNAseq documentation built on July 7, 2023, 11:10 a.m.