[R] r-help using random generating

Wiener, Matthew matthew_wiener at merck.com
Wed Mar 19 14:35:53 CET 2003


You can save some time by generating all your samples at one time:

t1 <- matrix(rnorm(5 * n, 100, 10), nc = n)
apply(t1, 2, mean)
(Or use colVars and colMeans to save even more time)

Hope this helps,

Matt Wiener

-----Original Message-----
From: Cheryl H. [mailto:cherylh at montana.edu] 
Sent: Tuesday, March 18, 2003 11:26 PM
To: R-help at stat.math.ethz.ch
Subject: [R] r-help using random generating


To whom it may concern:
Given that my sample size is n, my mean is 100, and my sd is 10, I need to 
use a random number generator (which I believe is the function 
rnorm(5,100,10)), but I need to repeat it a large number of times, and then 
plot the sampling distributions of the sample means, sd's, and variances of 
those generated sets. I'm having a real hard time trying to figure out how 
to do this easily. Please help if possible! Thanks,
Cheryl

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


------------------------------------------------------------------------------



More information about the R-help mailing list