Simulate data with a specified correlation in relation to an existing
variable.
Usage
complement(y, rho, x)
Value
Vector of a variable that has a specified correlation in relation to a given
variable y.
Arguments
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 y. Used for
calculating the residuals of the least squares regression of x
against y, to remove the y component from x.
Details
Simulates data with a specified correlation in relation to an existing
variable.