You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jim Largent <je...@gmail.com> on 2006/09/17 22:15:20 UTC
Commons Math
I installed the Commons math library and used the example code shown below:
// Get a DescriptiveStatistics instance using factory method
DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
// Add the data from the array
for( int i = 0; i < inputArray.length; i++) {
stats.addValue(inputArray[i]);
}
// Compute some statistics
double mean = stats.getMean();
double std = stats.getStandardDeviation();
double median = stats.getMedian();
I get an error saying that the getMedian function is not found. I saw that
the SummaryStatistics does not have the median. Any insight on what I'm
missing?
Thanks
Re: Commons Math
Posted by Brent Worden <br...@gmail.com>.
Try stats.getPercentile(50), instead.
HTH,
Brent Worden
On 9/17/06, Jim Largent <je...@gmail.com> wrote:
>
> I installed the Commons math library and used the example code shown
> below:
> // Get a DescriptiveStatistics instance using factory method
> DescriptiveStatistics stats = DescriptiveStatistics.newInstance();
>
> // Add the data from the array
> for( int i = 0; i < inputArray.length; i++) {
> stats.addValue(inputArray[i]);
> }
>
> // Compute some statistics
> double mean = stats.getMean();
> double std = stats.getStandardDeviation();
> double median = stats.getMedian();
>
>
> I get an error saying that the getMedian function is not found. I saw
> that
> the SummaryStatistics does not have the median. Any insight on what I'm
> missing?
> Thanks
>
>