|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object peakml.math.Statistical
public abstract class Statistical
The class Statistical
contains methods for performing basis statistical operations,
such as mean, median, standard deviation. Also supported are correlation analysis, factorial
calculations, ranking, analysis of variance, etc. Basically it provides the toolbox for
performing an analysis of a set of data.
Field Summary | |
---|---|
static int |
COLUMN
Indicates that the column should be processed |
static int |
MAXIMUM
The maximum value in the result of the stats(double[]) method. |
static int |
MEAN
The mean value in the result of the stats(double[]) method. |
static int |
MINIMUM
The minimum value in the result of the stats(double[]) method. |
static int |
NRSTATS
The total number of statistics in the result of the stats(double[]) method. |
static int |
PEARSON_CORRELATION
The correlation value in the result of the pearsonsCorrelation(double[], double[]) method. |
static int |
PEARSON_FISHER
The fisher transformed correlation (normally distributed) in the result of the pearsonsCorrelation(double[], double[]) method. |
static int |
PEARSON_FISHER_STDDEV
The fisher transformed standard error value in the result of the pearsonsCorrelation(double[], double[]) method. |
static int |
PEARSON_TTEST
The student's t-test value in the result of the pearsonsCorrelation(double[], double[]) method. |
static int |
QUARTILE_LOWER
The lower quartile in the result of the quartiles(double[]) method. |
static int |
QUARTILE_MEDIAN
The median quartile in the result of the quartiles(double[]) method. |
static int |
QUARTILE_UPPER
The upper quartile in the result of the quartiles(double[]) method. |
static int |
ROW
Indicates that the row should be processed |
static int |
SHAPIRO_WILK_PVALUE
The p-value in the result of the shapiroWilk(double[]) method. |
static int |
SHAPIRO_WILK_WSTAT
The w-statistic in the result of the shapiroWilk(double[]) method. |
static int |
SPEARMAN_CORRELATION
The correlation value in the result of the spearmanCorrelation(double[], double[]) method. |
static int |
SPEARMAN_TWOSIDED_SIGNIFICANCE
The significant level in the result of the spearmanCorrelation(double[], double[]) method. |
static int |
STDDEV
The standard deviation value in the result of the stats(double[]) method. |
static int |
VARIANCE
The variance value in the result of the stats(double[]) method. |
Constructor Summary | |
---|---|
Statistical()
|
Method Summary | |
---|---|
static double |
beta(double z,
double w)
|
static double |
betacf(double a,
double b,
double x)
|
static double |
betai(double a,
double b,
double x)
|
static double |
binomialln(int n,
int k)
A binomial is a polynomial with two terms—the sum of two monomials—often bound by parenthesis or brackets when operated upon. |
static double |
durbinWatson(double[] values)
Simplistic implementation of the Durbin-Watson statistic. |
static double |
durbinWatsonCERN(double[] values)
This implementation has been taken from http://www.lbl.gov/ |
static double |
factorialln(int n)
In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. |
static double |
ftest(double[] a,
double[] b)
An F-test is any statistical test in which the test statistic has an F-distribution if the null hypothesis is true. |
static double |
gammaln(double z)
The gamma function interpolates the factorial function. |
static double |
geomean(double[] values)
The geometric mean, in mathematics, is a type of mean or average, which indicates the central tendency or typical value of a set of numbers. |
static int |
indexOfMax(double[] values)
|
static double |
interquartileRange(double[] values)
In descriptive statistics, the interquartile range (IQR), also called the midspread, middle fifty and middle of the #s, is a measure of statistical dispersion, being equal to the difference between the third and first quartiles. |
static double |
kthElement(double[] values,
int k)
Returns the k-th smallest value in the given array. |
static double |
max(double[] values)
Calculates the maximum value from the values in the given array. |
static double |
mean(double[] values)
Calculates the mean of the values in the given array. |
static double |
median(double[] values)
Calculates the median of the values in the given array. |
static double |
min(double[] values)
Calculates the minimum value from the values in the given array. |
static void |
normalize(double[] values)
Normalizes the values in the given vector to the maximum (ie the maximum value will be 1). |
static void |
normalize(double[] values,
double max)
Normalizes the values in the given vector to given the maximum. |
static double[] |
pearsonsCorrelation(double[] xvalues,
double[] yvalues)
In statistics, the Pearson product-moment correlation coefficient (sometimes referred to as the MCV or PMCC, and typically denoted by r) is a common measure of the correlation (linear dependence) between two variables X and Y. |
static double |
pearsonsCorrelationS(double[] xvalues,
double[] yvalues)
|
static double[] |
permute(double[] vector)
Randomly permutes the values in the given vector. |
static double[][] |
permute(double[][] data,
int rowcolumn)
Randomly permutes the values in the given matrix. |
static void |
qsort(double[] values,
double[]... arrays)
|
static double[] |
quartiles(double[] values)
Quartiles partition the corresponding distribution into four quarters each containing 25% of the data. |
static double[][] |
rank(double[][] data,
boolean reversed,
int rowcolumn)
Highly optimized function for ranking the contents of a matrix either on the COLUMN or the ROW. |
static double[] |
rank(double[] data,
boolean reversed)
Highly optimized function for ranking the contents of a vector. |
static double |
rsd(double[] values)
|
static double[][] |
scale(double[][] data,
int rowcolumn)
Calculates the standard score for either each row or each column. |
static double[] |
shapiroWilk(double[] values)
The Shapiro-Wilk test tests the null hypothesis that a sample x1, ..., xn came from a normally distributed population. |
static double[] |
spearmanCorrelation(double[] xvalues,
double[] yvalues)
Calculates the Spearman rank correlation and the two-sided significance levels of its deviation from zero between the two given arrays. |
static double |
spearmanCorrelationS(double[] xvalues,
double[] yvalues)
|
static double[] |
stats(double[] values)
Calculates some basic statistics on the given array of data. |
static double |
stddev(double[] values)
The standard deviation of a sample is one measure of statistical dispersion, calculated by taking the square root of the deviation. |
static double |
sum(double[] values)
Calculates the sum of the values in the given array. |
static double |
ttest(double[] a,
double[] b)
A t-test is any statistical hypothesis test in which the test statistic has a Student's t distribution if the null hypothesis is true. |
static double |
variance(double[] values)
The variance of a sample is one measure of statistical dispersion, averaging the squared distance of its possible values from the expected value (mean). |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int ROW
public static final int COLUMN
public static final int MINIMUM
stats(double[])
method.
public static final int MAXIMUM
stats(double[])
method.
public static final int MEAN
stats(double[])
method.
public static final int VARIANCE
stats(double[])
method.
public static final int STDDEV
stats(double[])
method.
public static final int NRSTATS
stats(double[])
method.
public static final int QUARTILE_LOWER
quartiles(double[])
method.
public static final int QUARTILE_MEDIAN
quartiles(double[])
method.
public static final int QUARTILE_UPPER
quartiles(double[])
method.
public static final int SHAPIRO_WILK_WSTAT
shapiroWilk(double[])
method.
public static final int SHAPIRO_WILK_PVALUE
shapiroWilk(double[])
method.
public static final int PEARSON_CORRELATION
pearsonsCorrelation(double[], double[])
method.
public static final int PEARSON_FISHER
pearsonsCorrelation(double[], double[])
method.
public static final int PEARSON_FISHER_STDDEV
pearsonsCorrelation(double[], double[])
method.
public static final int PEARSON_TTEST
pearsonsCorrelation(double[], double[])
method.
public static final int SPEARMAN_CORRELATION
spearmanCorrelation(double[], double[])
method.
public static final int SPEARMAN_TWOSIDED_SIGNIFICANCE
spearmanCorrelation(double[], double[])
method.
Constructor Detail |
---|
public Statistical()
Method Detail |
---|
public static double min(double[] values)
values
- The array with the values.
public static double max(double[] values)
values
- The array with the values.
public static int indexOfMax(double[] values)
public static double sum(double[] values)
values
- The array with the values.
public static double mean(double[] values)
values
- The array with the values.
public static double geomean(double[] values) throws java.lang.IllegalArgumentException
values
- The array with the values.
java.lang.IllegalArgumentException
- Thrown when the array has 0 elements or the array contains one or more negative values.http://en.wikipedia.org/wiki/Geometric_mean
public static double median(double[] values)
kthElement(double[], int)
is used for other cases.
values
- The array with the values.
public static double variance(double[] values)
values
- The array with the values.
http://en.wikipedia.org/wiki/Variance
public static double stddev(double[] values)
values
- The array with the values.
http://en.wikipedia.org/wiki/Standard_deviation
public static double rsd(double[] values)
values
-
public static double kthElement(double[] values, int k)
values
- The array with the values.k
- The index.
public static double[] stats(double[] values)
MINIMUM
, MAXIMUM
,
MEAN
, VARIANCE
and
STDDEV
.
values
- The array with the values.
public static double[] quartiles(double[] values)
values
- Array with the distribution to quartile.
http://en.wikipedia.org/wiki/Quartile
,
http://www.vias.org/tmdatanaleng/cc_quartile.html
public static double interquartileRange(double[] values)
values
- The array with the values.
http://en.wikipedia.org/wiki/Interquartile_range
public static void normalize(double[] values)
values
- The array with the values.public static void normalize(double[] values, double max)
values
- The array with the values.max
- The maximum to scale to.public static double[][] scale(double[][] data, int rowcolumn)
data
- The data matrix to be scaledrowcolumn
- Either ROW
or COLUMN
.public static double[] pearsonsCorrelation(double[] xvalues, double[] yvalues)
xvalues
- The array with the x-values.yvalues
- The array with the y-values.
public static double pearsonsCorrelationS(double[] xvalues, double[] yvalues)
public static double[] spearmanCorrelation(double[] xvalues, double[] yvalues)
xvalues
- The array with the x-values.yvalues
- The array with the y-values.
public static double spearmanCorrelationS(double[] xvalues, double[] yvalues)
public static double factorialln(int n)
gammaln(double)
method, which is highly optimized.
n
- The non-negative integer.
public static double binomialln(int n, int k)
n
- The non-negative integer.k
- The non-negative integer.
public static double ttest(double[] a, double[] b)
a
- Population 1.b
- Population 2.
public static double ftest(double[] a, double[] b)
a
- Population 1.b
- Population 2.
public static double[] rank(double[] data, boolean reversed)
A binary search is utilized to find the rank-values of each of the cells.
data
- The data vector to rank.reversed
- When set to true, the ranks will be reversed
public static double[][] rank(double[][] data, boolean reversed, int rowcolumn) throws java.lang.IllegalArgumentException
A binary search is utilized to find the rank-values of each of the cells.
data
- The data-matrix to rankreversed
- When set to true, the ranks will be reversedrowcolumn
- Either ROW
or COLUMN
java.lang.IllegalArgumentException
public static final void qsort(double[] values, double[]... arrays)
values
- arrays
- public static double[] permute(double[] vector)
vector
- The vector which needs to be permuted.
public static double[][] permute(double[][] data, int rowcolumn) throws java.lang.IllegalArgumentException
ROW
or COLUMN
. This method makes
use of an internally seeded with time of creation for this class. This should ensure
that the pseudo random values generated are reasonable. The passed matrix is not
affected.
data
- The matrix to be permuted.rowcolumn
- Either ROW
or COLUMN
java.lang.IllegalArgumentException
- Thrown when the rowcolumn parameter has an illegal valuepublic static double gammaln(double z)
z
- The value for which to calculate the gammaln.
http://lib.stat.cmu.edu/apstat/245
public static double beta(double z, double w)
public static double betai(double a, double b, double x)
public static double betacf(double a, double b, double x)
public static double[] shapiroWilk(double[] values) throws java.lang.IllegalArgumentException
values
- The distribution to test.
SHAPIRO_WILK_PVALUE
and SHAPIRO_WILK_WSTAT
).
java.lang.IllegalArgumentException
- Thrown when the length of the vector is less than 3 elements.public static double durbinWatson(double[] values)
values
- The array with the values.
public static double durbinWatsonCERN(double[] values)
values
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |