You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mikkel Meyer Andersen (JIRA)" <ji...@apache.org> on 2010/07/14 20:15:49 UTC

[jira] Created: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Characteristic (support, mean, variance, ...) on Distributions
--------------------------------------------------------------

                 Key: MATH-385
                 URL: https://issues.apache.org/jira/browse/MATH-385
             Project: Commons Math
          Issue Type: New Feature
            Reporter: Mikkel Meyer Andersen


I wish that the Distributions could contain some characteristics. For example support, mean, and variance.

Support:
AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.

Mean and variance:
double get{Mean, Variance}() should be on AbstractDistribution.

With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.

Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888577#action_12888577 ] 

Phil Steitz commented on MATH-385:
----------------------------------

+1 for adding all of these to the abstract classes.  While not needed for current implementations, it might be good to add isSupportConnected().  Will need to carefully doc things like the fact that infinite values would never be "included".  Also, where exactly would you expect to see NaN?

In many (most?) cases, the cost of computing the parameters in constructors will be negligible, so I would favor initialization in the constructors unless there is significant computation to be done.   One thing we might want to consider for 3.0 is to deprecate the parameter setters, making the distribution classes immutable, so recomputing, etc. would become unnecessary.

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Mikkel Meyer Andersen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888583#action_12888583 ] 

Mikkel Meyer Andersen commented on MATH-385:
--------------------------------------------

I agree that we need to handle non-connected support, and a isSupportConnected might be a way to do it (dealing with it properly in {Lower, Upper}Bound-functions if it is not connected). Or else we should think of support as an array of supports, but I think that would complicate it all too much. But the idea might give rise to an Interval-class consisting of endpoints (lower and upper bounds) together with indication of whether they are inclusive or not, and whether the interval is continuous or discrete.

I would never expect to see NaN in support (I'm not sure if my expectations are valid), but in mean and variance it is very reasonable to expect a NaN, e.g. is neither mean nor variance defined for the Cauchy distribution.

Regarding the significance of the computations, you might be right. But I think it should be possible to specify not to do it before get()'ting the mean etc. E.g. is the mean for the Weibull constructed by computing a sum which might contain many terms depending on the parameters. It would not be a problem in 3.0 when removing the ability to change the parameters. If we simply add a boolean isMeanCalculated etc. this behavior can easily be obtained.

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Mikkel Meyer Andersen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikkel Meyer Andersen updated MATH-385:
---------------------------------------

    Attachment: MATH385-PATCH1

Patch proposal for the logic.

I haven't added any tests yet; I'd like to hear the opinion about the logic before creating the testing functions.

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>         Attachments: MATH385-PATCH1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12888618#action_12888618 ] 

Phil Steitz commented on MATH-385:
----------------------------------

+1  for not trying to represent non-connected sets of support (especially since there could in principle be an unbounded number of these).  Note that even in this case the lower and upper support bounds are meaningful.  So these with isSupportConnected = false is valuable and consistent information.  True means you have more information.

+1 for NaN for undefined moments.

+1 for caching / not caching characteristics depending on what is involved.



> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915046#action_12915046 ] 

Phil Steitz commented on MATH-385:
----------------------------------

I am OK with waiting for 3.0; but its close to done now ;) 

One more thing I forgot to mention.  Let's make sure to document the computing formulas in the javadoc.

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>         Attachments: MATH385-PATCH1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Mikkel Meyer Andersen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mikkel Meyer Andersen updated MATH-385:
---------------------------------------

    Attachment: MATH385-PATCH2

Patch 2 with the proposed changed.

The invalidation (until distributions become immutable in 3.0) is implemented in invalidateParameterDependentMoments(). This is called is in the non-internal setters, because when they are deleted, so should the call to invalidateParameterDependentMoments() (so it has been marked as deprecated already).

Note: Not all, actually quite a few, did not have setters for the parameters, e.g. beta distribution. I'm not sure why, but these are of course not calling invalidateParameterDependentMoments().

Besides that, formulas for the mean, variance and support have been added.

Which kind of tests should be done? Simple (N(0,1) has mean 0 and variance 1 etc.) - and maybe some that rely on sampling emperical data with a big error margin? Or what do you propose?

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>         Attachments: MATH385-PATCH1, MATH385-PATCH2
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Mikkel Meyer Andersen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915038#action_12915038 ] 

Mikkel Meyer Andersen commented on MATH-385:
--------------------------------------------

What about just changing the fix version to 3.0? Or would it be being too lazy?

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>         Attachments: MATH385-PATCH1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated MATH-385:
-----------------------------

    Fix Version/s: 2.2

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915033#action_12915033 ] 

Phil Steitz commented on MATH-385:
----------------------------------

Looks good, modulo one pesky detail that will go away when things become immutable in 3.0:  you need to modify setters that could change characteristics to set the isCalculated flags to false.

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>         Attachments: MATH385-PATCH1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-385) Characteristic (support, mean, variance, ...) on Distributions

Posted by "Mikkel Meyer Andersen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915128#action_12915128 ] 

Mikkel Meyer Andersen commented on MATH-385:
--------------------------------------------

That's right. On both points. I'll see to it ASAP (hopefully tonight).

> Characteristic (support, mean, variance, ...) on Distributions
> --------------------------------------------------------------
>
>                 Key: MATH-385
>                 URL: https://issues.apache.org/jira/browse/MATH-385
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Mikkel Meyer Andersen
>             Fix For: 2.2
>
>         Attachments: MATH385-PATCH1
>
>   Original Estimate: 5h
>  Remaining Estimate: 5h
>
> I wish that the Distributions could contain some characteristics. For example support, mean, and variance.
> Support:
> AbstractContinuousDistribution and AbstractIntegerDistribution should have double getSupport{Lower, Upper}Bound() and int getSupport{Lower, Upper}Bound(), respectively. Also methods a la boolean isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution should reflect if the support is open of closed. In practise the implemented distributions are easy since the support for all continuous distributions are real intervals (connected sets), and the support for all the discrete distributions are connected integer sets. This means that the lower and upper bound (together with isSupport{Lower, Upper}BoundInclusive() on AbstractContinuousDistribution because it is not needed on the discrete distributions because of their nature) are sufficient for determine the support.
> Mean and variance:
> double get{Mean, Variance}() should be on AbstractDistribution.
> With such characteristic an invalidateParameters-method might come in handy because they often depend on the parameters. The characteristics should not be calculated before the first time they are get'ted, and when calculated, they should be saved for later use.  When parameters change, an invalidateParameters-method should be called to force the characteristics to be recalculated.
> Values such as Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, and Double.NaN should be used where appropriate.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.