Reorder draws to a target correlation (Iman-Conover)
iman_conover.RdEvery component keeps exactly its own draws; only their pairing across
simulations changes. The correlation of the result's normal scores is
close to correlation, and Spearman's rho close to
(6 / pi) * asin(correlation / 2).
Arguments
- x
- correlation
A correlation matrix with one row and column per component.
- seed
Seed for shuffling the scores, a whole number.
- dof
Student t reference scores with these degrees of freedom, which give more joint extremes than the default normal scores (CAS Monograph 15, section 8.2.3;
aggregate'sdof).- scores
Reference scores of your own, one per simulation, in any order. Give
doforscores, not both.- shuffle_rows
Shuffle the result's rows. Without it the first component comes back sorted ascending, which matters to anything that reads the rows in order or a slice of them; whole-sample statistics do not notice.
Value
A predictive_distribution with the same keys and marginals.
Examples
pd <- predictive_distribution(
cbind(1:1000, (1:1000 * 7919) %% 1000),
data.frame(lob = c("a", "b"))
)
joined <- iman_conover(pd, matrix(c(1, 0.7, 0.7, 1), 2), seed = 3)
cor(draw_matrix(joined), method = "spearman")
#> [,1] [,2]
#> [1,] 1.0000000 0.6815972
#> [2,] 0.6815972 1.0000000