flexIC {flexIC} | R Documentation |
Run the flexible Iman–Conover (flexIC) transform
Description
Applies the “best-of-m” Iman–Conover algorithm to coerce a data matrix to a target Spearman rank-correlation structure while preserving each column’s marginal distribution.
Usage
flexIC(x, target_r = NULL, eps = 0.04, max_iter = 50)
Arguments
x |
Numeric matrix or data frame to transform. |
target_r |
Optional target rank-correlation matrix; defaults to
|
eps |
Convergence tolerance for the maximum absolute r-difference. |
max_iter |
Maximum number of candidate draws to evaluate. |
Value
A list with three components
- data
Numeric matrix with transformed columns.
- max_abs_diff
Largest absolute difference between achieved and target correlations.
- iter
Index of the candidate draw that achieved
max_abs_diff
.
Examples
set.seed(1)
x <- matrix(rnorm(300), ncol = 3)
target <- matrix(c(1, .6, .3,
.6, 1, .4,
.3, .4, 1), 3)
out <- flexIC(x, target, eps = 0.02, max_iter = 10)
str(out)
[Package flexIC version 0.1.3 Index]