« R2jags: Bayesian Hierarchical Modeling in R | Main | Find information about R with Rseek.org »

February 11, 2009


Feed You can follow this conversation by subscribing to the comment feed for this post.

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.

Cheers! Joel.

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

thank you! very clear.

Thank you! This helped me more to learn R!

Thanks :D

thanks. helped me a lot. well explained

Algorithm A1. Central limit theorum method. (Generates a single value, X).
1. For i = 1 to 12:
(a) Generate Ui uniform(0; 1)
2. Let X =sum(random numbers i)-6
3. Deliver X

Is this correct?
z<- 1:12

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

Thank you for posting this! Looking to see if you have one that generates column headers.

Assume there are 5 variables: x,y,z,q,w.

Assume you want to assign 2000 obs to each of the variables above. Hence: 5*2000 = 10000 obs.

Then the way to perform this in R is:
> a10000data<-as.vector(runif(10000))
> x<-a10000data[1:2000]
> y<-a10000data[2001:4000]
> z<-a10000data[4001:6000]
> q<-a10000data[6001:8000]
> w<-a10000data[8001:10000]

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.

Erdogan CEVHER
The Ministry of Science, Industry and Technology of Turkey

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.

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

The comments to this entry are closed.

R for the Enterprise

Got comments or suggestions for the blog editor?
Email David Smith.
Follow revodavid on Twitter Follow David on Twitter: @revodavid

Search Revolutions Blog