Learn R Programming

simdata (version 0.4.1)

cor_from_upper: Build correlation matrix

Description

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

Usage

cor_from_upper(n_var, entries = NULL)

Value

Matrix with user supplied entries.

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) .

See Also

cor_to_upper

Examples

Run this code
cor_from_upper(2, rbind(c(1, 2, 0.8)))

Run the code above in your browser using DataLab