MathGroup Archive 2007

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

Search the Archive

Re: how to get random numbers from a distribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81501] Re: how to get random numbers from a distribution
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Wed, 26 Sep 2007 06:37:47 -0400 (EDT)

On 9/24/07 at 4:19 AM, tdoxmail at gmail.com wrote:

>I am a new Mathematica user. I have a function that i use to
>generate a probability distribution (eg x^2). I want a random number
>generator, that should generate values from this probability
>distribution only,

>I know this Random function in mathematica, that can generate in
>particular range, but how do i tell to generate from a particular
>distribution.

>I created a list of values using my probability function but not
>able to integrate it with Random function so that random numnber
>takes value from that  list.

=46irst, x^2 is not a probability distribution. For a function to
be a probability distribution, integrating the function over the
domain of the function must yield 1. That is,

3 x^2 over restricted to the range of 0 to 1 is a probability
distribution function since

In[14]:= Integrate[3*x^2, {x, 0, 1}]

Out[14]= 1

=46or this particular case, inverting the cumulative distribution
function is probably the simplest most direct way to get the
desired distribution. That is

RandomReal[]^(1/3)

has the desired distribution.

There are other methods to get arbitrary distributions from the
uniform distribution when the inverse of the cumulative
distribution function cannot be expressed as simply in closed
form. A good discussion of various methods to do this can be
found in the text Seminumerical Algorithms Vol 2 by Knuth.
Another good reference is Mathematical Statistics for
Mathematica by Colin Rose and Murray Smith. This text comes with
a Mathmatica package (mathstatica) that can do what you want.
Note, the currently available version of mathstatica is
compatible with Mathematica version 5.2 and has not yet been
updated to be compatible with version 6.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: making a list using table but with different increment after a certain number
  • Next by Date: Re: how to get random numbers from a distribution
  • Previous by thread: Re: how to get random numbers from a distribution
  • Next by thread: Re: how to get random numbers from a distribution