[R] Generation of correlated variables
Filoche
pmassicotte at hotmail.com
Thu Mar 15 19:14:27 CET 2012
Hi there.
This is not really working. Here what I have for the moment.
library(ecodist)
x <- 1:100
y1 <- corgen(x=x, r=.85, epsilon=.01)$y
y2 <- corgen(x=x, r=.5, epsilon=.01)$y
y3 <- corgen(x=x, r=.25, epsilon=.01)$y
a = poly(cbind(y1, y2, y3), degree=1)
cor(a[,1], a[,2])
In that case, the correlation between y1 and y2 is the same as a[,1] and
a[,2].
Regards,
Phil
--
View this message in context: http://r.789695.n4.nabble.com/Generation-of-correlated-variables-tp4475799p4475891.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list