lt.monarch.math
Class Statistics

java.lang.Object
  extended by lt.monarch.math.Statistics

public class Statistics
extends java.lang.Object


Constructor Summary
Constructor and Description
Statistics()
           
 
Method Summary
Modifier and Type Method and Description
static double average(java.util.List<java.lang.Object> values)
          Calculates the man value of input data.
static double c4(double x)
          C4 function
static double cumulative(double x, double mu, double sigma)
          Cumulative normal distribution
static double Gamma(double x)
          Gamma function
static boolean isNormalDistribution(java.util.List<java.lang.Double> d)
          Deprecated. 
static double max(java.util.Collection<java.lang.Object> values)
          Get maximum
static double mean(ArrayDataModel model, DataColumnType valType)
          Calculates mean value.
static double median(ArrayDataModel model, DataColumnType valType)
          Calculates median value.
static double median(java.util.List<java.lang.Object> values)
           
static double min(java.util.List<java.lang.Object> values)
          Get minimum
static double normal(double x)
          Normal distribution
static double normal(double x, double mean, double std)
           
static double normp(double z)
          Cumulative normal distribution
static float randomLevy(float c, float alpha)
           
static StatResults stat(ArrayDataModel model, DataColumnType valType)
          Return mean, variance and standard deviation in StatResults object.
static double stdev(ArrayDataModel model, DataColumnType valType)
          Calculates standard deviation value
static double[] swilk(java.util.List<java.lang.Double> d)
          Runs the Shapiro-Wilk test on a list of double values.
static double variance(ArrayDataModel model, DataColumnType valType)
          Calculates variance value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statistics

public Statistics()
Method Detail

median

public static double median(ArrayDataModel model,
                            DataColumnType valType)
Calculates median value. Nulls are skipped. Median is calculated according the specified data column. The other data column is not taken into account.

Parameters:
model - data model
valType - data model column name
Returns:
median value

mean

public static double mean(ArrayDataModel model,
                          DataColumnType valType)
Calculates mean value. Nulls are skipped.

Parameters:
model - data model
valType - value type which will be used to calculate
Returns:
mean value

stat

public static StatResults stat(ArrayDataModel model,
                               DataColumnType valType)
Return mean, variance and standard deviation in StatResults object. Other values in StatResults object remain Double.NaN type.

Parameters:
model - data model
valType - value type which will be used to calculate
Returns:
mean, variance, standard deviation

stdev

public static double stdev(ArrayDataModel model,
                           DataColumnType valType)
Calculates standard deviation value

Parameters:
model - data model
valType - value type which will be used to calculate
Returns:
standard deviation value

variance

public static double variance(ArrayDataModel model,
                              DataColumnType valType)
Calculates variance value

Parameters:
model - data model
valType - value type which will be used to calculate
Returns:
variance value

Gamma

public static double Gamma(double x)
Gamma function

Parameters:
x -
Returns:

c4

public static double c4(double x)
C4 function

Parameters:
x -
Returns:

normp

public static double normp(double z)
Cumulative normal distribution

Parameters:
z -
Returns:

cumulative

public static double cumulative(double x,
                                double mu,
                                double sigma)
Cumulative normal distribution

Parameters:
x -
mu -
sigma -
Returns:

normal

public static double normal(double x)
Normal distribution

Parameters:
x -
Returns:

normal

public static double normal(double x,
                            double mean,
                            double std)

average

public static double average(java.util.List<java.lang.Object> values)
                      throws DataFormatException
Calculates the man value of input data. Ignores null and empty values in the input data.

Parameters:
values - list of numbers
Returns:
mean value
Throws:
DataFormatException - then list is empty, or values list does not contain numbers.

min

public static double min(java.util.List<java.lang.Object> values)
                  throws DataFormatException
Get minimum

Parameters:
values - list of numbers
Returns:
Throws:
DataFormatException

max

public static double max(java.util.Collection<java.lang.Object> values)
                  throws DataFormatException
Get maximum

Parameters:
values - list of numbers
Returns:
Throws:
DataFormatException

median

public static double median(java.util.List<java.lang.Object> values)

isNormalDistribution

@Deprecated
public static boolean isNormalDistribution(java.util.List<java.lang.Double> d)
Deprecated. 


swilk

public static double[] swilk(java.util.List<java.lang.Double> d)
Runs the Shapiro-Wilk test on a list of double values.

Returns:
an array of size two if everything goes well, or null if there's an error.

randomLevy

public static float randomLevy(float c,
                               float alpha)