# create two random variables of length 100 with correlation
# of 0.10 +/- 0.01
corgen(len=100, r=.1, epsilon=0.01)
# create a variable y drawn from a population with the given correlation to x
x <- 1:100
y <- corgen(x=x, r=.25, population=FALSE)$yRun the code above in your browser using DataLab