Re: Random Sampling in 2D with a Known Distribution

From: andre (andrevh_at_sci.kun.nl)
Date: 10/26/04


Date: Tue, 26 Oct 2004 18:58:22 +0000 (UTC)

andrew@acooke.org (andrew cooke) wrote:
>Hi,
>
>Given a probability ditribution in 2D, how can I generate a list of
>points that reflects that distribution (ie more points where the
>probability is higher).
>
>It seems that somehow I want a cumulative distribution as a function
>of a single variable, which I can then invert and sample uniformly.
>However, I can't see how to get from 2D distribution to a single
>variable.
>
>I guess this is a common problem - if someone could just give me the
>standard name I can probably google for appropriate solutions.
>
>I'm interested in both approaches for analytically nice distributions
>and those that can only be handled numerically.
>
>Thanks,
>Andrew

The "analytical" way to get what you want would be to find two multi-variate
functions f1(x1,x2,...,xn) and f2(x1,x2,...,xn) such that your density
P(y1,y2) is given by

  P(y1,y2) = integral( dirac( y1-f1(x1,...,xn) )*dirac( y2-f2(x1,...,xn) ) )

where the integral is over all variables x1=0..1, x2=0..1, ... ,xn=0..1.
The minimal number of variables you would need is 2. But in general it is too
difficult to find such functions.

The most common, but maybe inefficient, alternative is the following (don't
know the name, would call it "rejection")

Given a number A and a pdf G such that A*G(y1,y2) >= P(y1,y2) for all
y1,y2 you are interested in, you generate (y1,y2) from G and x uniformly
in [0,1]. If x*A*G(y1,y2) =< P(y1,y2) you accept, and else you reject
y1,y2,x and try again. The simplest, but maybe not the most efficient, is of
course to take the uniform distribution for G(y1,y2).



Relevant Pages

  • Random Sampling in 2D with a Known Distribution
    ... Given a probability ditribution in 2D, how can I generate a list of ... It seems that somehow I want a cumulative distribution as a function ... standard name I can probably google for appropriate solutions. ...
    (sci.stat.math)
  • Re: How to test a distribution for uniformity?
    ... > observations occured is roughly uniform. ... > distribution of observation times differs significantly from ... I am using bins (those are my 45 minute ... I wonder is there such a thing as a chi-square test which is adjusted to ...
    (sci.stat.math)
  • Re: How to test a pseudo random prime number generator?
    ... number generators. ... This method is efficient but does not produce a uniform distribution ... approximate distribution of gaps. ...
    (sci.math)
  • Re: random number problem
    ... It's a simple linear transformation. ... your distribution will be ... which is what theory says it should be for a uniform ... If you want a *serious* random number generator, ...
    (comp.programming)
  • Re: Random numbers
    ... But it's still biased (that is, not a unform distribution). ... The OP does not specify a uniform ... is that the resulting distribution should be uniform. ... to use the RNG provided for the range 1 to 5. ...
    (sci.math)