# How to sample this?

1. Dec 3, 2009

### Alamino

I would appreciate if someone could give me some idea about how to solve this sampling problem. I have a distribution W(x,y) of fields x and y characterized by a population of N vectors (x,y). I have to sample x and y fields according to a second distribution Q(x,y) which is related to W by:

Q(x,y) = W(x,y) F(y),

where given some y, I know how to calculate F(y). Now, I can sample from W simply by choosing a vector from my population and then, I can calculate F(y). I am hoping I can use something similar to the rejection method to sample from Q.

Does anyone has some idea about that?

Cheers,
Roberto.

2. Dec 3, 2009

### Gan_HOPE326

Uhm... I'm not sure I understood what actually IS your problem. Do you have just a bunch of values, or an analytical shape for W(x,y)? Anyway, I think you could do like this:

1) Pick a vector from W(x,y)
2) Calculate F(y)
3) Use it as a probability and make a random sort; if it's "yes", then keep the value; otherwise, reject it and pick another one. Like, if F(y) (normalized) is 0.7, then you have a 70% probability you'll keep the vector.

In this way, final values should be distributed following Q(x,y). And it's some sort of rejection method.