GenMatrix: Generate correlation matrix

GenMatrixR Documentation

Generate correlation matrix

Description

A shortcut to generate correlation matrix. The generated matrix is the input of the GenData.

Usage

GenMatrix(p, rlist = list(), varnames = NULL)

Arguments

p

number of variables in the matrix

rlist

a list to add values to matrix. The vectors in the list contain three elements, with the first two being the position of names of variables, and the last one being the correlations between them.

varnames

variable names. If NULL, the varnames are defaulted as x1, ..., xp.

Author(s)

Shuo Wang

Examples


m <- GenMatrix(3, rlist = list(c(1, 2, 0.5), c(1, 3, 0.3), c(2, 3, 0.7)))
m

m <- GenMatrix(3, rlist = list(c("x1", "x2", 0.5), c("x1", "x3", 0.3), 
                               c("x2", "x3", 0.7)))
m


ShuoStat/RIE documentation built on March 19, 2022, 3:30 a.m.