s-news
[Top] [All Lists]

simulation

To: s-news@lists.biostat.wustl.edu
Subject: simulation
From: Daikwon Han <dhan@acsu.buffalo.edu>
Date: Thu, 16 Nov 2000 20:00:33 -0500 (EST)
Dear all,

 Can anyone help me to create 100 numbers from the below program ?  
I'm doing simulation to pick up random numbers and calculate the change of
total values over time. The first thing I did is to pick up the 1000
numbers between 0 and 1 under the uniform distribution and add all the 
values less than .01 as follows.

 x<-runif(1000,0,1) 
 x<-sum(as.numeric(x<.01)) 

 Let's say, I got 9 as x value at the first trial, then I want to repeat
it 100 times so that I can get 100 different numbers. 
 I've tried "for(i in 1:100)" and "while(i<101)" loop, but it doesn't work
well. I also tried matrix, append command, I only got the same number
repeated 100 times, probably the first one(same 100 numbers in the table).
 
 My question is how to make a loop to keep each value at each trial(should
be 100 different numbers at 100 trials). Any help would be appreciated.
 Thank you.

-----------------------------
 Daikwon Han, Ph.D Candidate 
 Department of Geography
 SUNY at Buffalo
 Buffalo, NY 14226
-----------------------------
 







<Prev in Thread] Current Thread [Next in Thread>