public class Stats
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static double[] |
chiSquareValues95
χ-squared distribution.
|
| Constructor and Description |
|---|
Stats() |
| Modifier and Type | Method and Description |
|---|---|
static double |
chiSqu95Interval(int freedom)
Returns the upper bound for the 95% confidence interval
for the χ-squared distribution with n degrees of freedom.
|
static double |
chiSquare(int[] observedCounts,
double[] expectedCounts)
Returns χ-square value given observed counts and expected counts.
|
static double |
chiSquare(int[] observedCounts,
int[] expectedCounts)
Returns χ-square value given observed counts and expected counts.
|
static double |
G(int[] observedCounts,
double[] expectedCounts)
Returns G value given observed counts and expected counts.
|
static double |
lowerBoundNormal95(double mean,
double variance)
Calculates the lower bound for a 95% confidence interval
for a normal distribution with given mean and variance
i.e., the value above which 97.5% of sample take.
|
static double |
lowerBoundNormal95Lower(double mean,
double variance)
Calculates the lower bound for a 95% confidence interval
for a normal distribution with given mean and variance, upper only
i.e., the value above which 95% of sample take.
|
static int |
maxIndex(java.util.ArrayList<java.lang.Integer> array)
Returns an index that takes the maximum element in the array list.
|
static int |
maxIndex(double[] array)
Returns an index that takes the maximum element in the array.
|
static int |
maxIndex(int[] array)
Returns an index that takes the maximum element in the array.
|
static int |
minIndex(java.util.ArrayList<java.lang.Integer> array)
Returns an index that takes the minimum element in the array list.
|
static int |
minIndex(double[] array)
Returns an index that takes the minimum element in the array.
|
static int |
minIndex(int[] array)
Returns an index that takes the minimum element in the array.
|
static double |
round(double n,
int dp)
Rounds the double n to dp decimal places.
|
static double |
sdtDevSampled(double[] data)
Calculates the standard deviation for sampled data.
|
static double |
sdtDevSampled(double[] data,
double sum)
Calculates the standard deviation for sampled data, using:
s = sqrt( (Sigma_i (x_i - x)^2) / (n-1) ) |
static double |
upperBoundForZero(int freedom,
int sampleSize)
Calculates the upper bound for zero information leakage.
|
static double |
upperBoundNormal95(double mean,
double variance)
Calculates the upper bound for a 95% confidence interval
for a normal distribution with given mean and variance
i.e., the value below which 97.5% of sample take.
|
static double |
upperBoundNormal95Upper(double mean,
double variance)
Calculates the upper bound for a 95% confidence interval
for a normal distribution with given mean and variance, lower only
i.e., the value below which 95% of sample take.
|
public static double[] chiSquareValues95
public static double chiSqu95Interval(int freedom)
freedom - freedomjava.lang.IllegalArgumentException - If freedom ≤ 0public static double chiSquare(int[] observedCounts,
double[] expectedCounts)
observedCounts - array of observed countsexpectedCounts - array of expected countspublic static double chiSquare(int[] observedCounts,
int[] expectedCounts)
observedCounts - array of observed countsexpectedCounts - array of expected countspublic static double G(int[] observedCounts,
double[] expectedCounts)
observedCounts - array of observed countsexpectedCounts - array of expected countspublic static double lowerBoundNormal95(double mean,
double variance)
mean - meanvariance - variancepublic static double lowerBoundNormal95Lower(double mean,
double variance)
mean - meanvariance - variancepublic static int maxIndex(java.util.ArrayList<java.lang.Integer> array)
array - integer array listpublic static int maxIndex(double[] array)
array - double arraypublic static int maxIndex(int[] array)
array - integer arraypublic static int minIndex(java.util.ArrayList<java.lang.Integer> array)
array - integer array listpublic static int minIndex(double[] array)
array - integer arraypublic static int minIndex(int[] array)
array - integer arraypublic static double round(double n,
int dp)
n - double valuedp - decimal placesjava.lang.IllegalArgumentException - If dp < 0public static double sdtDevSampled(double[] data)
data - sampled datapublic static double sdtDevSampled(double[] data,
double sum)
data - sampled datasum - summation of the datapublic static double upperBoundForZero(int freedom,
int sampleSize)
freedom - freedomsampleSize - the number of samplespublic static double upperBoundNormal95(double mean,
double variance)
mean - meanvariance - variancepublic static double upperBoundNormal95Upper(double mean,
double variance)
mean - meanvariance - variance