MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Random sampling of an arbitrary distribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59790] Re: Random sampling of an arbitrary distribution
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sun, 21 Aug 2005 03:51:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 8/20/05 at 3:14 AM, h.l.owen at dl.ac.uk (Owen, HL (Hywel)) wrote:

>I would like to generate a number of sample values which are
>distributed according to an arbitrary probability distribution,
>e.g. not Uniform, Normal, or any of the ones in the
>ContinuousDistributions package. Given a pure function distfn, I
>can see how to sample it over the range distmin to distmax using
>the following:

>MonteCarloSample[distfn_, distmin_, distmax_] := Module[{a, b},
>    While[(a = Random[Real, {distmin, distmax}]; b = Random[];
>        b > distfn[a])];
>    a]

>This is fine and works well, except when distmin and distmax are
>widely apart when it becomes inefficient. Does anyone know an
>alternative method which:

>a) allows samples to be drawn from an arbitrarily large range (e.g. up
>to infinity if desired)

>b) remains efficient at large range values.

I am not aware of a method that meets your requirements for an *arbitrary* distribution function. But it is quite possible to get significant inprovements for *specific* distribution functions other than those currently in the ContinuousDistributions package.

For example, if the inverse cumulative distribution function is known and can be easily computed then f[Random[]] where f is the inverse cumulative distribution function will be very efficient.

Is there a function that transforms deviates a standard probability distribution into the specific distribution you are looking for? If so, applying that function to random deviates generated from the standard distribution function will work.

For other ideas, take a look at Seminumerical Algorithms Vol 2 by Knuth. Also, you might find mathstatica <http://www.mathstatica.com/> useful.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Random sampling of an arbitrary distribution
  • Next by Date: Re: How to specify boundary conditions on all 4 sides of a plate for a steady state heat equation (PDE) using NDSolve? (Laplace equation)
  • Previous by thread: Re: Random sampling of an arbitrary distribution
  • Next by thread: Re: Re: Random sampling of an arbitrary distribution