MathGroup Archive 2007

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

Search the Archive

Re: RandomArray from user defined distribution?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73356] Re: RandomArray from user defined distribution?
  • From: Bill Rowe <readnewsciv at sbcglobal.net>
  • Date: Tue, 13 Feb 2007 07:04:02 -0500 (EST)

On 2/12/07 at 5:01 AM, robIV at piovere.com (rob) wrote:

>I'd like to use the RandomArray to produce some data from what I
>think is a Poisson distribution in t P[t] = a^2 t Exp[-a*t]  where a
>is mean, sigma.

The PDF for a Poisson distribution isn't what you have written
above. Instead, it is

In[8]:=
PDF[PoissonDistribution[a],t]

Out[8]=
a^t/(E^a*t!)

>I see one can use RandomArray to produce sample data from a lot of
>continuous distributions but the Poisson isn't among them (it's only
>available in the discrete form).

RandomArray definitely works with discrete distributions as
demonstrated by

In[10]:=
SeedRandom[1];

In[11]:=
Timing[a=Table[Random[PoissonDistribution[3]],{1000}];]

Out[11]=
{0.612178 Second,Null}

In[12]:=
SeedRandom[1];

In[13]:=
Timing[b=RandomArray[PoissonDistribution[3],1000];]

Out[13]=
{0.008636 Second,Null}

In[14]:=
a==b

Out[14]=
True

Note, the difference between
RandomArray[PoissonDistribution[3],1000] and doing
Random[PoissonDistribtuion[3]] 1000 times is that RandomArray
makes use of details of the specific algorithm for generating
Poisson deviates. And since RandomArray is specifically coded
for each distribution that similar performance improvements are
possible, it is not a good starting point for creating your own
custom distribution. To roll your own, you will want to start
from Random rather than RandomArray.

=46inally, you should be aware creating your own random number
generator for an arbitrary distribution is far from a trivial
exercise. The text Seminumerical Algorithms Vol 2 by Knuth
provides quite a bit of detail regarding psuedo random number
generators. Another good source of information is the text by
Colin Rose and Murray Smith, Mathmatical Statistics  with
Mathematica. This latter reference is particularly useful as it
comes with a package for Mathematica that among other things
provides tools for generating random numbers from arbitrary
distributions. More information about this can be found at <http://www.mathstatica.com/>
--
To reply via email subtract one hundred and four


  • Prev by Date: system of equations
  • Next by Date: Re: Re: can't InstallJava[] on Linux-x86-64 to Import an xls file
  • Previous by thread: Re: RandomArray from user defined distribution?
  • Next by thread: Re: RandomArray from user defined distribution?