decor: Create uncorrelated data

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

Create a matrix where columns are (Pearson) uncorrelated.

Usage

1
decor(seedMat)

Arguments

seedMat

A matrix where the number of rows is no less than the number of columns. The function will change seedMat.

Details

Algorithm: for i = 2 to ncol(seedMat), the function replaces the first i - 1 elements of the ith column with values such that the new ith column becomes uncorrelated with the first i - 1 columns.

Value

None.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(123)
X = matrix(rnorm(1000), ncol = 10)
corMat = cor(X)
summary(corMat[corMat < 1]) # Off-diagonal.
# Min.      1st Qu.   Median     Mean  3rd Qu.     Max.
# -0.19271 -0.05648 -0.02272 -0.01303  0.01821  0.24521


SimJoint::decor(X)
corMat2 = cor(X)
summary(corMat2[corMat2 < 1])
# Min.           1st Qu.    Median       Mean    3rd Qu.       Max.
# -2.341e-17 -3.627e-18  3.766e-18  4.018e-18  1.234e-17  3.444e-17

SimJoint documentation built on Dec. 11, 2021, 9:29 a.m.

Related to decor in SimJoint...