commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Matthew Rowles (JIRA)" <>
Subject [jira] Updated: (MATH-287) Add support for weighted descriptive statistics
Date Fri, 21 Aug 2009 05:50:14 GMT


Matthew Rowles updated MATH-287:

    Attachment: weighted.patch

I've added weighted options for Mean, Product, Sum and Variance. I've also added a test method
to AbstractUnivariateStatistic.

When I run svn diff to generate a patch file, there are a lot of "changes" that I haven't
done (lots of - a line followed by + the same line), and as a result, the file is about 27k.
I don't know what I did wrong...

In my first pass at this problem, the test method tests that the weights array isn't null,
is the same length as the values array, and checks each value to ensure they aren't negative.
This last check could get a bit time consuming - weighted variance needs a weighted mean needs
a weighted sum - all checking the same weights array... The check itself is necessary; I can't
see any way around it other than making up a Weights class that knows that it is correct.

Additionally, the new evaluate methods essentially duplicate that of the existing methods,
with only the bits that are affected by the weighting being changed. I had an idea that you
could have a call to evaluate(values, begin, length) be sent off to evaluate(values, null,
begin, length) and have appropriate null checks being done to decide whether or not to do
a weighted/unweighted analysis, but I thought that may not be appropriate.

Feedback more than welcome...

> Add support for weighted descriptive statistics
> -----------------------------------------------
>                 Key: MATH-287
>                 URL:
>             Project: Commons Math
>          Issue Type: New Feature
>    Affects Versions: 2.0
>            Reporter: Matthew Rowles
>            Priority: Minor
>         Attachments: weighted.patch
> Add support for weighted descriptive statistics, such as weighted variance.
> An example method call would be Variance.evaluate(double[] values, double[] weights,
int begin, int length)
> - Suggested by on the mailing list.

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

View raw message