|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.fhcrc.cpl.toolbox.statistics.BasicStatistics
public class BasicStatistics
A class with generic methods for basic stats. Add methods as needed. A lot of things are written twice, once for floats and once for doubles. That's annoying. But it would be wasteful of space and time to do conversions
| Constructor Summary | |
|---|---|
BasicStatistics()
|
|
| Method Summary | |
|---|---|
static double |
calcNormalCumDensity(double mu,
double sigma,
double x)
Calculate the cumulative density of the normal distribution function with parameters mu and sigma, at point x |
static double |
calcNormalDistDensity(double mu,
double sigma,
double x)
Calculate the density of the normal distribution function with parameters mu and sigma, at point x |
static double |
calcStandardNormalCumDensity(double z)
Calculate the cumulative density of the standard normal distribution at point x |
static double |
coefficientOfVariation(double[] input)
|
static double |
coefficientOfVariation(java.util.List<? extends java.lang.Number> input)
|
static double |
correlationCoefficient(double[] xvalues,
double[] yvalues)
covariance(xy) / (sx * sy) |
static float |
correlationCoefficient(float[] xvalues,
float[] yvalues)
covariance(xy) / (sx * sy) |
static double |
correlationCoefficient(java.util.List<? extends java.lang.Number> xvaluesList,
java.util.List<? extends java.lang.Number> yvaluesList)
|
static double |
covariance(double[] xvalues,
double[] yvalues)
Covariance = (sum(x*y) - ((sumx)(sumy)/n)) / (n-1) |
static float |
covariance(float[] xvalues,
float[] yvalues)
Covariance = (sum(x*y) - ((sumx)(sumy)/n)) / (n-1) |
static double |
erf(double z)
Error function for standard normal distribution |
static double |
geometricMean(double[] values)
Geometric mean is defined as ((x1)(x2)(x3)...(xk)) ^ 1/k |
static double |
geometricMean(double value1,
double value2)
|
static float |
geometricMean(float[] values)
|
static double |
geometricMean(java.util.List<? extends java.lang.Number> inputs)
|
static Pair<java.lang.Double,java.lang.Double> |
interQuartileRange(double[] inputs)
Calculate the interquartile range. |
static Pair<java.lang.Double,java.lang.Double> |
interQuartileRange(java.util.List<? extends java.lang.Number> inputs)
|
static double[] |
leverages(double[] inputs)
Compute the leverage of each input: (x-xbar)^2/((n-1)sigmax^2)) |
static float[] |
leverages(float[] inputs)
Compute the leverage of each input: (x-xbar)^2/((n-1)sigmax^2)) |
static double |
max(double[] values)
|
static float |
max(float[] values)
|
static double |
max(java.util.List<? extends java.lang.Number> values)
|
static double |
mean(double[] inputs)
Calculate the mean of the inputs |
static float |
mean(float[] inputs)
Calculate the mean of the inputs |
static double |
mean(int[] inputs)
Calculate the mean of the inputs |
static double |
mean(java.util.List<? extends java.lang.Number> inputs)
Calculate the mean of the inputs |
static double |
median(double[] inputs)
Calculate the median of the inputs. |
static float |
median(float[] inputs)
Calculate the median of the inputs. |
static double |
median(java.util.List<? extends java.lang.Number> inputs)
|
static double |
min(double[] values)
|
static double |
min(java.util.List<? extends java.lang.Number> values)
|
static double |
percentile(double[] values,
double p)
Returns an estimate of the pth percentile of the values
in the values array, starting with the element in (0-based)
position begin in the array and including length
values. |
static double |
percentile(java.util.List<? extends java.lang.Number> values,
double p)
calculate percentile p of values in list |
static double |
standardDeviation(double[] inputs)
Calculate the standard deviation of the inputs |
static float |
standardDeviation(float[] inputs)
Calculate the standard deviation of the inputs |
static double |
standardDeviation(java.util.List<? extends java.lang.Number> inputs)
|
static float |
standardDeviationFloatList(java.util.List<? extends java.lang.Number> inputs)
|
static double |
standardGaussian(double x)
Calculate a standard Gaussian with mean 0, variance 1 |
static double[] |
studentizedResiduals(double[] xValues,
double[] residuals)
Convenience method |
static double[] |
studentizedResiduals(double[] xValues,
double[] residuals,
double[] leverages)
Calculate the studentized residuals of arrays of somethingorother represented here by their X values, leverages (based on X values), and residuals. |
static double |
sum(double[] values)
|
static float |
sum(float[] values)
|
static double |
sum(java.util.List<? extends java.lang.Number> values)
|
static double |
variance(double[] inputs)
Calculate the variance of the inputs |
static float |
variance(float[] inputs)
Calculate the variance of the inputs |
static double |
weightedGeometricMean(java.util.List<? extends java.lang.Number> inputs,
java.util.List<? extends java.lang.Number> weights)
Calculate the weighted geometric mean. |
static double |
weightedMean(java.util.List<? extends java.lang.Number> inputs,
java.util.List<? extends java.lang.Number> weights)
Calculate the weighted mean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BasicStatistics()
| Method Detail |
|---|
public static float standardDeviation(float[] inputs)
inputs -
public static double standardDeviation(double[] inputs)
inputs -
public static double standardDeviation(java.util.List<? extends java.lang.Number> inputs)
public static float standardDeviationFloatList(java.util.List<? extends java.lang.Number> inputs)
public static float variance(float[] inputs)
inputs -
public static double variance(double[] inputs)
inputs -
public static double mean(int[] inputs)
inputs -
public static float mean(float[] inputs)
inputs -
public static double mean(java.util.List<? extends java.lang.Number> inputs)
inputs -
public static double mean(double[] inputs)
inputs -
public static double median(java.util.List<? extends java.lang.Number> inputs)
public static double median(double[] inputs)
inputs -
public static Pair<java.lang.Double,java.lang.Double> interQuartileRange(double[] inputs)
inputs -
public static Pair<java.lang.Double,java.lang.Double> interQuartileRange(java.util.List<? extends java.lang.Number> inputs)
public static double min(double[] values)
public static double min(java.util.List<? extends java.lang.Number> values)
public static double max(double[] values)
public static float max(float[] values)
public static double max(java.util.List<? extends java.lang.Number> values)
public static double percentile(java.util.List<? extends java.lang.Number> values,
double p)
values - p -
public static double percentile(double[] values,
double p)
pth percentile of the values
in the values array, starting with the element in (0-based)
position begin in the array and including length
values.
Calls to this method do not modify the array Copied from org.apache.commons.math.stat todo: figure out for sure whether having median() call this is OK
values - array of input valuesp - the percentile to compute
java.lang.IllegalArgumentException - if the parameters are not valid or the
input array is nullpublic static float median(float[] inputs)
inputs -
public static double[] leverages(double[] inputs)
inputs -
public static float[] leverages(float[] inputs)
inputs -
public static double[] studentizedResiduals(double[] xValues,
double[] residuals)
xValues - residuals -
public static double[] studentizedResiduals(double[] xValues,
double[] residuals,
double[] leverages)
xValues - residuals - leverages -
public static double sum(double[] values)
public static double sum(java.util.List<? extends java.lang.Number> values)
public static float sum(float[] values)
public static double coefficientOfVariation(double[] input)
public static double coefficientOfVariation(java.util.List<? extends java.lang.Number> input)
public static double covariance(double[] xvalues,
double[] yvalues)
xvalues - yvalues -
public static float covariance(float[] xvalues,
float[] yvalues)
xvalues - yvalues -
public static double correlationCoefficient(java.util.List<? extends java.lang.Number> xvaluesList,
java.util.List<? extends java.lang.Number> yvaluesList)
public static double correlationCoefficient(double[] xvalues,
double[] yvalues)
public static float correlationCoefficient(float[] xvalues,
float[] yvalues)
public static double geometricMean(double[] values)
values -
public static double geometricMean(java.util.List<? extends java.lang.Number> inputs)
public static float geometricMean(float[] values)
public static double geometricMean(double value1,
double value2)
public static double weightedGeometricMean(java.util.List<? extends java.lang.Number> inputs,
java.util.List<? extends java.lang.Number> weights)
inputs - weights -
public static double weightedMean(java.util.List<? extends java.lang.Number> inputs,
java.util.List<? extends java.lang.Number> weights)
inputs - weights -
public static double standardGaussian(double x)
x -
public static double calcNormalDistDensity(double mu,
double sigma,
double x)
mu - sigma - x -
public static double erf(double z)
z -
public static double calcStandardNormalCumDensity(double z)
z -
public static double calcNormalCumDensity(double mu,
double sigma,
double x)
mu - sigma - x -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||