Skip to content
Prev 206094 / 398503 Next

Conditional Sampling

On 12-Jan-10 14:00:24, ehcpieterse wrote:
OK, if I now understand you, you are interested in the properties
of the remaining (90) observations, given that they do not include
any of the (10) cases sampled in the first round.

In that case, I think you should adopt the sample.int() approach
I also suggested:

  X <- (1:100) ## (or any other 100 values)
  n <- sample.int(100,10,replace=FALSE) ## returns subset of (1:100)
  x <- X[n]
  Y <- X[-n]   ## The set remaining after the first 10 were taken
  ## Now you can sample repeatedly from Y until your eyes fall out.
  ## So build up a matrix of (say) 1000 samples from Y:
  M <- sample(Y,5,replace=FALSE)
  for(i in (2:1000)){ M <- rbind(M,sample(Y,5,replace=FALSE)) }

The repeated samples M of 5 from Y of course imply replacing each
sample of 5 back in Y, so they are available at each turn. You can
not, of course, sample 1000*5 from 100 without replacement! (Each
sample of 5 is obtained without replacement, however).

I hope this is getting close!
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 12-Jan-10                                       Time: 14:34:13
------------------------------ XFMail ------------------------------