1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to sample this?

  1. Dec 3, 2009 #1
    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?

  2. jcsd
  3. Dec 3, 2009 #2
    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.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook