commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mikkel Meyer Andersen <m...@mikl.dk>
Subject Re: [math] Generate random data using the Inverse CDF Method?
Date Tue, 27 Oct 2009 13:30:24 GMT
Hi, sorry for that:
Bug: http://issues.apache.org/jira/browse/MATH-309
Proposal: http://issues.apache.org/jira/browse/MATH-310

Cheers, Mikkel.

2009/10/27 Ted Dunning <ted.dunning@gmail.com>:
> Mikkel,
>
> Hate to put you to extra work here, but take a look here:
> http://commons.apache.org/math/issue-tracking.html
>
> The idea is that you file an issue with JIRA and attach your patch there.
> In order to encourage that, this mailing list strips attachments.
>
>
> On Tue, Oct 27, 2009 at 4:08 AM, Mikkel Meyer Andersen <mikl@mikl.dk> wrote:
>
>> I've attached a prototype diff-proposal where I've changed
>> AbstractContinuousDistribution and AbstractIntegerDistribution, and
>> implemented the nextExponential on the ExponentialDistribution as an
>> example of overwriting the nextSample-method from the
>> Abstract-distributions.
>>
>> Only AbstractContinuousDistribution and AbstractIntegerDistribution
>> extends AbstractDistribution, and both AbstractIntegerDistribution and
>> AbstractContinuousDistribution has an
>> inverseCumulativeProbability-function. But in
>> AbstractContinuousDistribution the inverse cdf returns a double, and
>> at AbstractIntegerDistribution it - naturally - returns an integer.
>> Therefor the nextSample is not put on AbstractDistribution, but on
>> each extension with different return types.
>>
>> RandomGenerator as parameter instead of getting a RNG inside the
>> nextSample, because one typically wants to use the same RNG because
>> often several random samples are wanted. Another option is to have a
>> RNG as a field in the class, but that would be more ugly and also
>> result in several RNGs at runtime.
>>
>> I found an error as well. In RandomDataImpl, mean < 0 throws
>> exception, whereas in the distribution implementation an exception is
>> thrown if mean <= 0. RandomDataImpl is corrected to <= in because that
>> is the correct definition.
>>
>> The function nextExponential couldn't - without further notice - be
>> removed from RandomDataImpl, because nextPoisson and the ValueServer
>> uses the function directly. So here is an issue. nextPoisson can
>> create a ExponentialDistribution and sample from that. ValueServer
>> could do the same, but what to you think about it?
>>
>> As mentioned, the diff is only a prototype hence no formal patch
>> submitted. And no tests has been made neither. But should I report a
>> bug or supply a separate patch on the small mean-problem in
>> nextExponential in RandomDataImpl?
>>
>> Cheers, Mikkel.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>
>
>
> --
> Ted Dunning, CTO
> DeepDyve
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message