[Date Index]
[Thread Index]
[Author Index]
Re: Re: sorry, but more q's on random numbers
*To*: mathgroup at smc.vnet.net
*Subject*: [mg50573] Re: [mg50544] Re: sorry, but more q's on random numbers
*From*: DrBob <drbob at bigfoot.com>
*Date*: Fri, 10 Sep 2004 04:06:43 -0400 (EDT)
*References*: <200409090919.FAA19484@smc.vnet.net>
*Reply-to*: drbob at bigfoot.com
*Sender*: owner-wri-mathgroup at wolfram.com
In line with Bill's answer, look in the ContinuousDistributions.m file which is in
C:\Program Files\Wolfram Research\Mathematica\5.0\AddOns\StandardPackages\Statistics
on my machine, and look for these lines:
exponential = Compile[{{lambda, _Real}, {q, _Real}}, -Log[q]/lambda]
ExponentialDistribution/: Random[ExponentialDistribution[lambda_:1]] :=
exponential[lambda, Random[]]
As you can see, Mathematica computes Exponential variates by taking the Log of a Uniform variate.
Bobby
On Thu, 9 Sep 2004 05:19:13 -0400 (EDT), Bill Rowe <readnewsciv at earthlink.net> wrote:
> On 9/8/04 at 5:15 AM, sean_incali at yahoo.com (sean kim) wrote:
>
>> What kind of distribution do I get if I take the base 10 Log of
>> Random[Real, {range}]?
>
> A truncated reflected exponential distribution. For any distribution, the cumulative distribution function, cdf, maps the domain of the distribution to 0,1. In particular, the cdf for the exponential distribution is:
>
> << "Statistics`"
> CDF[ExponentialDistribution[a], x]
>
> 1 - E^((-a)*x)
>
> Recognizing this must range from 0 to 1 and 1-Random[] is a uniform random deviate then
>
> Log[10, 1 - %] // PowerExpand
>
> -((a*x)/Log[10])
>
> shows -Log[10,Random[]] to be a exponential distribution. Omitting the minus sign reflects the distribution about the origin. Adding a range restriction truncates the distribution.
>
>> is that Log Uniform? or normal?
>
> No, see above.
>
>> also What's the best way to show what type of distribution it is?
>> I was thinking of listplot.
>
> There are a number of ways to show characteristics of the distribution. Which is best depends on what you are trying to show. Most of the time, I would plot some version of the empirical distribution function. For example,
>
> data = Sort@Table[Random[], {25}];
> ListPlot[Transpose@
> {data,
> Rest@FoldList[Plus, 0, data]/Total@data}];
>However, often people perfer to see the density function which is approximated by plotting a histogram. The difficulty with plotting histograms is appropriately choosing the bin width.
> --
> To reply via email subtract one hundred and four
>
>
>
--
DrBob at bigfoot.com
www.eclecticdreams.net
Prev by Date:
**Re: Re: How to solve a simple Trig cofunction?**
Next by Date:
**Re: Exact real numbers**
Previous by thread:
**Re: sorry, but more q's on random numbers**
Next by thread:
**Re: sorry, but more q's on random numbers**
| |