View source: R/simulateComplement.R
complement | R Documentation |
Simulate data with a specified correlation in relation to an existing variable.
complement(y, rho, x)
y |
The existing variable against which to simulate a complement variable. |
rho |
The correlation magnitude, ranging from [-1, 1]. |
x |
(optional) Vector with the same length as |
Simulates data with a specified correlation in relation to an existing variable.
Vector of a variable that has a specified correlation in relation to a given
variable y
.
https://stats.stackexchange.com/a/313138/20338
Other simulation:
simulateAUC()
,
simulateIndirectEffect()
v1 <- rnorm(100)
complement(y = v1, rho = .5)
complement(y = v1, rho = -.5)
v2 <- complement(y = v1, rho = .85)
plot(v1, v2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.