|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.math.Stat
public final class Stat
This class contains algorithms and utilities for stochastics and statistical mathematics.
It works much like the standard class Math
extended for
statistics.
MathUtilities
,
Combinatorical
Method Summary | |
---|---|
static double |
arithmeticMean(double[] x)
Returns the arithmetic mean (average) of a set of n values. |
static double |
average(double[] x)
Normal arithmetic mean of a set of values. |
static double |
coefficientOfCorrelation(double[] x,
double[] y)
Returns the (2D) coefficient of correlation of a set of n pairs (xi,yi). |
static double |
coefficientOfVariation(double[] x)
Returns the coefficient of variation of a set of n values. |
static Function |
functionalRegression(Function composedFunc,
Matrix experiment)
Performs linear regression to estimate a composed function with least squares. |
static double |
geometricMean(double[] x)
Returns the geometric mean of a set of n values. |
static double |
harmonicMean(double[] x)
Returns the harmonic mean of a set of n values. |
static double |
mean(double[] x)
Normal arithmetic mean of a set of values. |
static double |
meanDeviation(double[] x)
Returns the mean absolute deviation of a set of n values. |
static double |
median(double[] x)
Returns the median of a set of n values sorted in ascending numerical order. |
static double |
quantile(double[] x,
double a)
Returns the a-quantile of a set of n values sorted in ascending numerical order. |
static Vector |
regression(Function[] funcs,
Matrix experiment)
Performs linear regression to estimate the statistical mean according to least squares. |
static Vector |
regression(Vector u,
Matrix A,
Matrix Cu)
Performs elemental linear regression to estimate the statistical mean according to the method of least squares. |
static double |
standardDeviation(double[] x)
Returns the standard deviation of a set of n values. |
static java.lang.String |
statistics(double[] x)
Returns a string with the usual descriptive statistics for an array of double values. |
static double |
trimmedMean(double[] x,
double a)
Returns the mean of a set of n values, sorted in ascending numerical order, with a fraction a of entries at each end dropped. |
static double |
variance(double[] x)
Returns the variance of a set of n values. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static double arithmeticMean(double[] x)
x
- the array of double values representing the set of statistical data.
public static double geometricMean(double[] x)
It is always true that geometricMean ≤ arithmeticMean. Sensitive to errorneous data.
x
- the array of double values representing the set of statistical data.
public static double harmonicMean(double[] x)
x
- the array of double values representing the set of statistical data.
public static double mean(double[] x)
arithmeticMean(double[])
,
average(double[])
public static double average(double[] x)
arithmeticMean(double[])
,
mean(double[])
public static double variance(double[] x)
x
- the array of double values representing the set of statistical data.
public static double standardDeviation(double[] x)
x
- the array of double values representing the set of statistical data.
public static double coefficientOfVariation(double[] x)
x
- the array of double values representing the set of statistical data.
public static double median(double[] x)
x
- the sorted array of double values representing the set of statistical data.
x(n-1)/2
if n is odd, and (xn/2-1 + xn/2) / 2
if n is even.Arrays.sort(double[])
,
System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)
public static double quantile(double[] x, double a)
quantile(x,0.25) is called "lower quartile", and quantil(ex,0.75) is called "upper quartile". The interquartile range, quantile(x,0.75)-quantile(x,0.25), is a good measure for statistical deviation. It is median(x)==quantile(x,0.5).
x
- the sorted array of double values representing the set of statistical data.a
- a number within the open range ]0,1[ that defines the quantile of which part of the data is desired.
xk
if n*a is no natural number (but fractional), and (xk-1 + xk) / 2
if n*a is a natural number, with k:=[n*a] (gaussian brackets).Arrays.sort(double[])
,
System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)
public static double trimmedMean(double[] x, double a)
x
- the sorted array of double values representing the set of statistical data.a
- a number within the semi-open range of [0,0.5[.
1/(n-2k)*(xk + ... + xn-k-1)
, with k:=[n*a] (gaussian brackets).Arrays.sort(double[])
,
System.arraycopy(java.lang.Object, int, java.lang.Object, int, int)
public static double meanDeviation(double[] x)
x
- the array of double values representing the set of statistical data.
public static java.lang.String statistics(double[] x)
public static double coefficientOfCorrelation(double[] x, double[] y)
x
- the array of double values representing the x part of the set of statistical data (with same length and in same order as y).y
- the array of double values representing the y part of the set of statistical data (with same length and in same order as x).
public static Function functionalRegression(Function composedFunc, Matrix experiment)
Unlike regression(Function[],Matrix)
, this method is a facade
that works for single parametric functions, only.
public static Vector regression(Function[] funcs, Matrix experiment)
u = a*f(x)
the coefficient-vector a can be estimated using experimental data.
The data of an experiment is represented as a matrix containing the experimental data for the parameter row-vectors x in the first columns and - in the last column - the experimental data of the result scalar ui of each experiment i.
Here û denotes the vector of n response variables, and â denotes the vector of p unknown parameters to be estimated. The function f must be determined according to a thesis.
regression(Vector, Matrix, Matrix)
public static Vector regression(Vector u, Matrix A, Matrix Cu) throws java.lang.ArithmeticException
u = A*a
an estimate ã
for the true coefficient-vector â is predicted such that
Here û denotes the vector of n response variables, and â denotes the vector of p unknown parameters to be estimated. The p predictor variables for n experiments are denoted by the n×p Matrix A.
This method is called with the experimentally deviated data u, A and the covariance Cu of the variables.
Comments: For Cu=IDENTITY(n), the result equals
pseudoInverse
(A) * u
u
- the experimental vector of n response variables.A
- the n×p Matrix of predictor variables for n experiments.Cu
- the n×n covariance Matrix of u.
The diagonal vector contains the variance during experimental determination of each variable,
the other components contain the covariance, with other values.
java.lang.IllegalArgumentException
- if response vector has another size than matrix height n.
java.lang.ArithmeticException
- if the solution would be (n-m) parametric since less experiments exist than unknown parameters.
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |