You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by David Erickson <ha...@gmail.com> on 2012/01/02 23:59:18 UTC

[math] Help understanding lower/upper/initialDomain in AbstractContinuousDistribution

Hi all-
I'm new to using the Math package but it looks great.  I need a couple
distributions that aren't currently included, one as an example is the
Generalized Extreme Value distribution
(http://en.wikipedia.org/wiki/Generalized_extreme_value_distribution).
 I've created a new class GeneralizedExtremeValueDistributionImpl that
extends AbstractContinuousDistribution and implements
cumulativeProbability:

    @Override
    public double cumulativeProbability(double x) throws MathException {
        if (xi != 0) {
            return -FastMath.pow(FastMath.E, FastMath.pow(1d+xi*((x -
mu)/sigma), -1/xi));
        } else {
            return -FastMath.pow(FastMath.E, FastMath.pow(FastMath.E,
-(x-mu)/sigma));
        }
    }

According to the API I also need to implement getInitialDomain,
getDomainLowerBound, getDomainUpperBound, I looked at the existing
docs and other implementations but I'm still unclear on how these are
used, and what I should be returning, particularly since the existing
implementations primarily check if p is < or > .5 and return a
(frequently) static value.  If anyone could help me shed some light on
this I would be very appreciative.  Primarily I just need to use the
distribution to generate RandomVariable values.

Thanks,
David

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


Re: [math] Help understanding lower/upper/initialDomain in AbstractContinuousDistribution

Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
Hello.

> >
> > Thanks, I was able to get it to work.  I could use 3.0 and in fact was
> > looking to use it but didn't see a 3.0 snapshot in Maven, is there a
> > Maven repo available receiving these snapshots?

https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-math/3.0-SNAPSHOT/

> [...]


Regards,
Gilles

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


Re: [math] Help understanding lower/upper/initialDomain in AbstractContinuousDistribution

Posted by Sébastien Brisard <se...@m4x.org>.
>
> Thanks, I was able to get it to work.  I could use 3.0 and in fact was
> looking to use it but didn't see a 3.0 snapshot in Maven, is there a
> Maven repo available receiving these snapshots?
>
> -David
>
You must check out the latest source from the SVN repository
https://svn.apache.org/repos/asf/commons/proper/math/trunk
and build it with maven (I think there also is an ant build file).

Regards,
Sébastien


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


Re: [math] Help understanding lower/upper/initialDomain in AbstractContinuousDistribution

Posted by David Erickson <ha...@gmail.com>.
2012/1/2 Sébastien Brisard <se...@m4x.org>:
> Hi David,
> 2012/1/2 David Erickson <ha...@gmail.com>:
>> Hi all-
>> I'm new to using the Math package but it looks great.  I need a couple
>> distributions that aren't currently included, one as an example is the
>> Generalized Extreme Value distribution
>> (http://en.wikipedia.org/wiki/Generalized_extreme_value_distribution).
>>  I've created a new class GeneralizedExtremeValueDistributionImpl that
>> extends AbstractContinuousDistribution and implements
>> cumulativeProbability:
>>
>>    @Override
>>    public double cumulativeProbability(double x) throws MathException {
>>        if (xi != 0) {
>>            return -FastMath.pow(FastMath.E, FastMath.pow(1d+xi*((x -
>> mu)/sigma), -1/xi));
>>        } else {
>>            return -FastMath.pow(FastMath.E, FastMath.pow(FastMath.E,
>> -(x-mu)/sigma));
>>        }
>>    }
>>
>> According to the API I also need to implement getInitialDomain,
>> getDomainLowerBound, getDomainUpperBound, I looked at the existing
>> docs and other implementations but I'm still unclear on how these are
>> used, and what I should be returning, particularly since the existing
>> implementations primarily check if p is < or > .5 and return a
>> (frequently) static value.  If anyone could help me shed some light on
>> this I would be very appreciative.  Primarily I just need to use the
>> distribution to generate RandomVariable values.
>>
> the methods you are referring to are used to provide an initial
> bracket to the solver for the computation of the inverse cumulative
> probability. It can be a very crude initial guess, provided that it
> indeed brackets the root (the solver will do the rest): hence the
> static values you are referring to.
>
> Please note that these methods have recently been removed in the
> latest version (3.0-SNAPSHOT). The implementation of new distributions
> should now be much more straightforward. Are you adverse to using this
> version?
>

Thanks, I was able to get it to work.  I could use 3.0 and in fact was
looking to use it but didn't see a 3.0 snapshot in Maven, is there a
Maven repo available receiving these snapshots?

-David

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


Re: [math] Help understanding lower/upper/initialDomain in AbstractContinuousDistribution

Posted by Sébastien Brisard <se...@m4x.org>.
Hi David,
2012/1/2 David Erickson <ha...@gmail.com>:
> Hi all-
> I'm new to using the Math package but it looks great.  I need a couple
> distributions that aren't currently included, one as an example is the
> Generalized Extreme Value distribution
> (http://en.wikipedia.org/wiki/Generalized_extreme_value_distribution).
>  I've created a new class GeneralizedExtremeValueDistributionImpl that
> extends AbstractContinuousDistribution and implements
> cumulativeProbability:
>
>    @Override
>    public double cumulativeProbability(double x) throws MathException {
>        if (xi != 0) {
>            return -FastMath.pow(FastMath.E, FastMath.pow(1d+xi*((x -
> mu)/sigma), -1/xi));
>        } else {
>            return -FastMath.pow(FastMath.E, FastMath.pow(FastMath.E,
> -(x-mu)/sigma));
>        }
>    }
>
> According to the API I also need to implement getInitialDomain,
> getDomainLowerBound, getDomainUpperBound, I looked at the existing
> docs and other implementations but I'm still unclear on how these are
> used, and what I should be returning, particularly since the existing
> implementations primarily check if p is < or > .5 and return a
> (frequently) static value.  If anyone could help me shed some light on
> this I would be very appreciative.  Primarily I just need to use the
> distribution to generate RandomVariable values.
>
the methods you are referring to are used to provide an initial
bracket to the solver for the computation of the inverse cumulative
probability. It can be a very crude initial guess, provided that it
indeed brackets the root (the solver will do the rest): hence the
static values you are referring to.

Please note that these methods have recently been removed in the
latest version (3.0-SNAPSHOT). The implementation of new distributions
should now be much more straightforward. Are you adverse to using this
version?

Best regards,
Sébastien


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


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