Given a target r-value, returns the correlation you need to induce in a bivariate normal distribution to have the target correlation after converting distributions.
The target correlation
The target distribution function for variable 1 (e.g., norm, binom, gamma, truncnorm)
The target distribution function for variable 2
Arguments to pass to the functions for distribution 1
Arguments to pass to the functions for distribution 2
Tolerance for optimise function
r-value to induce in the bivariate normal variables
See Distributions for distributions and their various arguments to specify in params1 and params2.
convert_r(target_r = 0.5,
dist1 = "norm",
dist2 = "binom",
params1 = list(mean = 100, sd = 10),
params2 = list(size = 1, prob = 0.5))
#> [1] 0.627
convert_r(target_r = 0.5,
dist1 = "norm",
dist2 = "likert",
params1 = list(mean = 100, sd = 10),
params2 = list(prob = c(5, 10, 20, 30, 20)))
#> [1] 0.531