Comments on How to choose a random number in RTypePad2009-02-10T19:41:06ZBlog Administratorhttps://blog.revolutionanalytics.com/tag:typepad.com,2003:https://blog.revolutionanalytics.com/2009/02/how-to-choose-a-random-number-in-r/comments/atom.xml/Aristide commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b019aff4341be970c2013-09-08T13:20:02Z2013-09-09T18:34:51ZAristideHow to do a randomization test in R. I explain: I have two mean of number of fish captured. Since...<p>How to do a randomization test in R. I explain: I have two mean of number of fish captured. Since the data are not parametric, I would like to use,instead of one of these non parametric tests, the randomization... It means if I try to compare the difference of the two means is this value an extreme, by means of constructing a statistic distribution and comparing the mean value difference from that distribution....Regards</p>NArun commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b019aff3f0bca970c2013-09-07T12:41:32Z2013-09-09T18:34:51ZNArunI have a yearly time series of extreme events i.e, time series of extreme value (largest). But the problem is...<p>I have a yearly time series of extreme events i.e, time series of extreme value (largest). But the problem is that the series has many missing values in it. How can I impute values in there and perform EVA? Please help me regarding it and I am a beginner using R.</p>Erdogan CEVHER commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b017c37c230e1970b2013-03-16T11:21:16Z2013-03-18T22:39:18ZErdogan CEVHERAssume there are 5 variables: x,y,z,q,w. Assume you want to assign 2000 obs to each of the variables above. Hence:...<p>Assume there are 5 variables: x,y,z,q,w.</p>
<p>Assume you want to assign 2000 obs to each of the variables above. Hence: 5*2000 = 10000 obs.</p>
<p>Then the way to perform this in R is:<br />
> a10000data<-as.vector(runif(10000))<br />
> x<-a10000data[1:2000]<br />
> y<-a10000data[2001:4000]<br />
> z<-a10000data[4001:6000]<br />
> q<-a10000data[6001:8000]<br />
> w<-a10000data[8001:10000]</p>
<p>I do not know whether these assignments can be performed at once or not. Anyway, my above code is just one way. Though it would be best if we learn from R community how one-step assignment is done for 5 variables.</p>
<p>Erdogan CEVHER<br />
The Ministry of Science, Industry and Technology of Turkey</p>Will Banks 3 commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b017c36ff1122970b2013-02-20T18:26:25Z2013-02-21T00:51:52ZWill Banks 3Thank you for posting this! Looking to see if you have one that generates column headers.<p>Thank you for posting this! Looking to see if you have one that generates column headers.</p>Asonganyi commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b0176163efa53970c2012-07-08T13:39:30Z2012-07-08T21:31:01ZAsonganyii have generated a sample of 100items but i wish to create sub-samples of these items of length 5 starting...<p>i have generated a sample of 100items but i wish to create sub-samples of these items of length 5 starting from zero to five. i tried <br />
sample(c(runif(100, min=0, max=5)), size=5, replace=T) but is definitely obtaining only a single sample. i wish to obtain 100 subsamples of size five from the pseudorandom sample of 100 earlier generated</p>darren commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b014e867ee7e0970d2011-03-04T21:41:37Z2011-03-04T21:41:37ZdarrenAlgorithm A1. Central limit theorum method. (Generates a single value, X). 1. For i = 1 to 12: (a) Generate...<p>Algorithm A1. Central limit theorum method. (Generates a single value, X).<br />
1. For i = 1 to 12:<br />
(a) Generate Ui uniform(0; 1)<br />
2. Let X =sum(random numbers i)-6<br />
3. Deliver X</p>
<p>Is this correct?<br />
r<-function(x,y){<br />
z<- 1:12<br />
x<-runif(z)<br />
sum(x)-6<br />
}<br />
r(1,2)</p>rmr commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b014e8678e98f970d2011-03-03T22:07:18Z2011-03-03T22:07:18Zrmrthanks. helped me a lot. well explained<p>thanks. helped me a lot. well explained</p>hadi commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b0147e05feae1970b2010-12-04T17:11:04Z2010-12-04T17:11:04ZhadiThanks :D<p>Thanks :D</p>Steve commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b0133f4441965970b2010-09-15T21:51:48Z2010-09-15T21:51:48ZStevehttp://www.t-gebeutelt.deThank you! This helped me more to learn R!<p>Thank you! This helped me more to learn R! </p>Kim commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b013481f3e16b970c2010-05-26T21:53:38Z2010-05-26T21:53:38ZKimthank you! very clear.<p>thank you! very clear. </p>Ben Bolker commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b011571f42e4a970b2009-07-11T14:11:17Z2009-07-11T14:11:17ZBen Bolker@Joel: read the relevant help pages carefully. The arguments of rnorm() are n [# of values to pick], mean (default...<p>@Joel: read the relevant help pages carefully. The arguments of rnorm() are n [# of values to pick], mean (default 0) and sd (1). If you want uniform deviates with a specified mean, you have to know that mean = (max+min)/2 and go from there ...</p>Joel commented on 'How to choose a random number in R'tag:typepad.com,2003:6a010534b1db25970b011571eeec72970b2009-07-10T17:10:27Z2009-07-10T17:10:27ZJoelgreat, really helpful. Is there a way to give the random numbers a mean? (ideally with a normal distribution as...<p>great, really helpful. Is there a way to give the random numbers a mean? (ideally with a normal distribution as well). These functions don't seem to have arguments that can do that. </p>
<p>Cheers! Joel. </p>