Skip to content
Back to formatted view

Raw Message

Message-ID: <4B4C85A5.4090509@gmail.com>
Date: 2010-01-12T14:22:29Z
From: Magnus Torfason
Subject: Conditional Sampling
In-Reply-To: <1263304824404-1012114.post@n4.nabble.com>

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.