I omit to precise that I already try to generate data based on the mean and sd of two variables.
x=rnorm(20,1,5)+1:20 y=rnorm(20,1,7)+41:60 simu<-function(x,y,n) { simu=vector("list",length=n) for(i in 1:n) { x=c(x,rnorm(1,mean(x),sd(x))) y=c(y,rnorm(1,mean(y),sd(y))) simu[[i]]$x<-x simu[[i]]$y<-y } return(simu) } test=simu(x,y,60) lapply(test, function(x) cor.test(x$x,x$y)) As you could see, the correlation is disappearing with increasing N. Perhaps, a bootstrap with lm or cor.test could solve my problem. 2012/3/13 guillaume chaumet <guillaumechau...@gmail.com> > Dear R list, > I have a population with two groups. I want to simulate an gradually > increase of the number of subjects for group 1 based on mean and sd of two > variables (correlated). > Bootstrap ? > Sample ? > Simulation ? ( > > I just search some clues. > Thank you > > Guillaume > > > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.