Skip to content

Problems with randomly generating samples

3 messages · Debbie Zhang, Nordlund, Dan (DSHS/RDA), (Ted Harding)

#
How about

samples <- rnorm(1000*100,0,1)
dim(samples) <- c(1000,100)

Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA  98504-5204
#
On 13-May-09 15:18:05, Debbie Zhang wrote:
One possibility is

  nsamples <- 1000
  sampsize <- 100
  Samples <- matrix(rnorm(nsamples*sampsize,0,1),nrow=nsamples)

Then each row of the matrix Samples will be a sample of size 'sampsize',
the i-th can be accessed as Samples[i,], and there are 'nsamples' rows
to choose from.

Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 13-May-09                                       Time: 16:46:05
------------------------------ XFMail ------------------------------