org.jfree.data.statistics
public abstract class Statistics extends Object
Method Summary | |
---|---|
static double | calculateMean(Number[] values)
Returns the mean of an array of numbers. |
static double | calculateMean(Number[] values, boolean includeNullAndNaN)
Returns the mean of an array of numbers.
|
static double | calculateMean(Collection values)
Returns the mean of a collection of Number objects.
|
static double | calculateMean(Collection values, boolean includeNullAndNaN)
Returns the mean of a collection of Number objects.
|
static double | calculateMedian(List values)
Calculates the median for a list of values ( Number objects).
|
static double | calculateMedian(List values, boolean copyAndSort)
Calculates the median for a list of values ( Number objects).
|
static double | calculateMedian(List values, int start, int end)
Calculates the median for a sublist within a list of values
( Number objects).
|
static double | calculateMedian(List values, int start, int end, boolean copyAndSort)
Calculates the median for a sublist within a list of values
( Number objects). |
static double | getCorrelation(Number[] data1, Number[] data2)
Calculates the correlation between two datasets. |
static double[] | getLinearFit(Number[] xData, Number[] yData)
Fits a straight line to a set of (x, y) data, returning the slope and
intercept.
|
static double[][] | getMovingAverage(Number[] xData, Number[] yData, int period)
Returns a data set for a moving average on the data set passed in.
|
static double | getSlope(Number[] xData, Number[] yData)
Finds the slope of a regression line using least squares.
|
static double | getStdDev(Number[] data)
Returns the standard deviation of a set of numbers.
|
calculateMean(values, true)
.
Parameters: values the values (null
not permitted).
Returns: The mean.
Parameters: values the values (null
not permitted). includeNullAndNaN a flag that controls whether or not
null
and Double.NaN
values are included
in the calculation (if either is present in the array, the result is
Double#NaN).
Returns: The mean.
Since: 1.0.3
Number
objects.
Parameters: values the values (null
not permitted).
Returns: The mean.
Number
objects.
Parameters: values the values (null
not permitted). includeNullAndNaN a flag that controls whether or not
null
and Double.NaN
values are included
in the calculation (if either is present in the array, the result is
Double#NaN).
Returns: The mean.
Since: 1.0.3
Number
objects).
The list of values will be copied, and the copy sorted, before
calculating the median. To avoid this step (if your list of values
is already sorted), use the Statistics
method.
Parameters: values the values (null
permitted).
Returns: The median.
Number
objects).
If copyAndSort
is false
, the list is assumed
to be presorted in ascending order by value.
Parameters: values the values (null
permitted). copyAndSort a flag that controls whether the list of values is
copied and sorted.
Returns: The median.
Number
objects).
Parameters: values the values, in any order (null
not
permitted). start the start index. end the end index.
Returns: The median.
Number
objects). The entire list will be sorted if the
ascending
false.
Parameters: values the values (null
not permitted). start the start index. end the end index. copyAndSort a flag that that controls whether the list of values
is copied and sorted.
Returns: The median.
Information about the correlation calculation was obtained from: http://trochim.human.cornell.edu/kb/statcorr.htm
Parameters: data1 the first dataset. data2 the second dataset.
Returns: The correlation.
Parameters: xData the x-data (null
not permitted). yData the y-data (null
not permitted).
Returns: A double array with the intercept in [0] and the slope in [1].
Parameters: xData an array of the x data. yData an array of the y data. period the number of data points to average
Returns: A double[][] the length of the data set in the first dimension, with two doubles for x and y in the second dimension
Parameters: xData the x-values (null
not permitted). yData the y-values (null
not permitted).
Returns: The slope.
Parameters: data the data (null
or zero length array not
permitted).
Returns: The standard deviation of a set of numbers.