[R] Conditional Sampling
Magnus Torfason
zulutime.net at gmail.com
Tue Jan 12 15:22:29 CET 2010
Would the following work, or is there a reason why it would not?
risk.set <- 1:100
first.10 <- sample(risk.set, 10)
remainder <- setdiff(risk.set, first.10)
for ( i in 1:1000 )
{
next.5 <- sample(remainder, 5)
do.something.with(next.5)
}
Best,
Magnus
On 1/12/2010 9:00 AM, ehcpieterse wrote:
>
> Thanks Ted, your solution does make perfect sense.
>
> The only question I still have is that I would like to sample the remaining
> 5 observations after I have randomly selected the first 10. Given the
> initial 10, I would like to sample the following 5 say 1,000 times to get a
> simulated conditional sample, if that makes any sense.
>
> I want to build this into an iterative process to see how the first sample
> affects the resulting samples. Even though all the observations have the
> same probabilty to get sampled, they each have a different expected value.
More information about the R-help
mailing list