Dear list,
I am currently doing some simulation studies where I want to compare different 
scenarios.
In particular, two scenarios should be compared: 10.000 cases in 100 groups 
with 100 cases per group and 10.000 cases in 100 groups with random group size 
(ranging from 5 to 500).

The first part is no problem:
> id <- seq(1,10000)
> group <- sort(rep(seq(1,100),100))

But I don't get along with the second scenario. Using sample does give me 100 
groups with random cases, but generates more than 10.000 cases:
> set.seed(13)
> sum(sample(5:500, 100))
[1] 24583

Another way could be generating one sample at a time and sum the cases. But 
this would end up in trail & error to fit the 10.000 cases. Maybe it would 
break rules of probability, too.

I'm convinced that there should be another (and even better) way to handle this 
problem in R... :-)


Best regards,
Arne Schulz

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to