Skip to contents

Use to specify correlation matrix in convenient way by giving entries of the upper triangular part.

Usage

cor_from_upper(n_var, entries = NULL)

Arguments

n_var

Integer, number of variables (= rows = columns of matrix).

entries

Matrix of correlation entries. Consists of 3 columns (variable_1, variable_2, correlation) that specify both variables and corresponding correlation in the upper triangular part of the matrix (i.e. variable_1 < variable_2) .

Value

Matrix with user supplied entries.

See also

Examples

cor_from_upper(2, rbind(c(1, 2, 0.8)))
#>      [,1] [,2]
#> [1,]  1.0  0.8
#> [2,]  0.8  1.0