decor {SimJoint} | R Documentation |
Create uncorrelated data
Description
Create a matrix where columns are (Pearson) uncorrelated.
Usage
decor(seedMat)
Arguments
seedMat |
A matrix where the number of rows is no less than the number of columns. The function will change |
Details
Algorithm: for i = 2
to ncol(seedMat)
, the function replaces the first i - 1
elements of the i
th column with values such that the new i
th column becomes uncorrelated with the first i - 1
columns.
Value
None.
Examples
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
[Package SimJoint version 0.3.12 Index]