Hi,


I have written the following code which works fine



step<-5

numSim<-15



N<-double(numSim)

A<-double(numSim)

F<-double(numSim)

M<-double(numSim)

genx<-double(numSim)



for (i in 1:numSim) {



N[i]<-20

PN<-(runif(N[i], 0, 1))

A[i]<-sum(ifelse(PN>0.2, 1, 0))



PF<- runif((A[i]*0.5), 0, 1)

F[i]<-sum(ifelse(PF>0.2, 1, 0))



PM<- runif((A[i]*0.5), 0, 1)

M[i]<-sum(ifelse(PM>0.2, 1, 0))



genx[i]<- (min(F[i], M[i])*12)



}



data<-data.frame(N, A, F, M, genx)



What I would like to do next is to make 'genx' from step '1' the seed for N
in step '2'- run the above code 15 times (numSim), make 'genx' from step '2'
the seed for N in step '3'- run the above code 15 times (numSim) etcÂ…



How do I do that?. Any advice would be greatly appreciated



Adriana (R-beginner)

        [[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.

Reply via email to