
Is there anyone who can help me with the following? It's hard to describe in a few words, but hope you'll understand.
 
I attempt to model refugee mortality over time using Monte Carlo. Before doing repetitive simulations, my function should go through only one survey/row at the time, but instead gives outcomes of all studies/rows, which is not correct, because it uses random numbers choosen from a range in study/row 1. 
 
How can I limit y to only go through one row?
 
y<-0rand<-runif(n=1,min=0,max=1)prob<-((cmr-cmrlci)^2)/((cmruci-cmrlci)*(cmr-cmrlci))if (rand<=prob) y<-sqrt(rand*(cmruci-cmrlci)*(cmr-cmrlci)) + cmrlciif (rand>prob) y<-cmruci-sqrt((1-rand)*(cmruci-cmrlci)*(cmruci-cmr))y<-round(y,digits=1)*10
Thank you in advance.
 
Akko Eleveld
 
_________________________________________________________________


	[[alternative HTML version deleted]]

