public class StatTest
extends java.lang.Object
In this class all the statistical tests and output modules are defined
Modifier and Type | Class and Description |
---|---|
class |
StatTest.InformationAboutClass
Class to store general information of the algorithms.
|
Modifier and Type | Field and Description |
---|---|
static int |
ContrastC
Classification Contrast Stat-test identifier.
|
static int |
ContrastR
Regression Contrast Stat-test identifier.
|
static int |
Dietterich5x2cvC
Classification Dietterich 5x2cv Stat-test identifier.
|
static int |
Dietterich5x2cvR
Regression Dietterich 5x2cv Stat-test identifier.
|
static int |
fC
Classification F Stat-test identifier.
|
static int |
fM
Regression F Stat-test identifier.
|
static int |
FriedmanAlignedC
Classification Aligned Friedman Stat-test identifier.
|
static int |
FriedmanAlignedR
Regression Aligned Friedman Stat-test identifier.
|
static int |
FriedmanC
Classification Friedman Stat-test identifier.
|
static int |
FriedmanI
Imbalanced Friedman Stat-test identifier.
|
static int |
FriedmanR
Regression Friedman Stat-test identifier.
|
static int |
generalC
Summary of classification data for multiple algorithms identifier.
|
static int |
generalI
Summary of data, multiple algorithms imbalanced
|
static int |
generalR
Summary of regression data for multiple algorithms identifier.
|
static int |
globalWilcoxonC
Classification Wilcoxon Stat-test identifier.
|
static int |
globalWilcoxonI
Imbalanced Wilcoxon Stat-test identifier.
|
static int |
globalWilcoxonR
Regression Wilcoxon Stat-test identifier.
|
static int |
MannWhitneyC
Classification Mann-Whitney Stat-test identifier.
|
static int |
MannWhitneyR
Regression Mann-Whitney Stat-test identifier.
|
static int |
MultipleC
Classification Multiple Stat-test identifier.
|
static int |
MultipleR
Regression Multiple Stat-test identifier.
|
static int |
QuadeC
Classification Quade Stat-test identifier.
|
static int |
QuadeR
Regression Quade Stat-test identifier.
|
static int |
ShapiroWilkC
Classification Shapiro Wilk Stat-test identifier.
|
static int |
ShapiroWilkR
Regression Shapiro Wilk Stat-test identifier.
|
static int |
summaryC
First classification algorithm summary of data identifier.
|
static int |
summaryI
Summary of data, 1 algorithm imbalanced
|
static int |
summaryR
First regression algorithm summary of data identifier.
|
static int |
tabularC
Summary of classification data for multiple algorithms identifier.
|
static int |
tabularI
Summary of data, multiple algorithms imbalanced
|
static int |
tabularR
Summary of regression data for multiple algorithms identifier.
|
static int |
tC
Classification t Stat-test identifier.
|
static int |
tR
Regression t Stat-test identifier.
|
static int |
trainTestC
Summary of data, train & test, one algorithm identifier (classification).
|
static int |
trainTestR
Summary of data, train & test, one algorithm identifier (regression).
|
static int |
WilcoxonC
Classification Wilcoxon signed ranks Stat-test identifier.
|
static int |
WilcoxonR
Regression Wilcoxon signed ranks Stat-test identifier.
|
Constructor and Description |
---|
StatTest(int selector,
double[][][][] d,
double[][][][] dtrain,
double significance,
java.lang.String nres,
java.lang.String nameRel,
java.util.Vector nameResults,
java.lang.String[] labels)
This method calls the selected statistical test or output module.
|
Modifier and Type | Method and Description |
---|---|
static double |
alnorm(double x,
int upper)
Quoted from original Fortran documentation:
Evaluates the tail area of the standardised normal curve
from x to infinity if upper is true or
from minus infinity to x if upper is false.
|
static double |
betainv(double x,
double p,
double q)
Quoted from original Fortran documentation:
Computes incomplete beta function ratio for arguments
x between zero and one, p and q positive.
|
static double |
correc(int i,
int n)
Quoted from original Fortran documentation:
Calculates correction for tail area of the i-th largest of n
order statistics.
|
static double |
lnfbeta(double a,
double b)
Computes natural logarithm of the beta function.
|
static double |
lnfgamma(double c)
Computes natural logarithm of the gamma function.
|
static double[] |
nscor2(int n,
int n2)
Quoted from original Fortran documentation:
Calculates approximate expected values of normal order statistics.
|
static double |
pf(double x,
double df1,
double df2)
Computes cumulative Snedecor F distribution
|
static double |
pnorm(double z,
boolean upper)
Computes cumulative N(0,1) distribution.
|
static double |
pnorm(double x,
boolean upper,
double mu,
double sigma2)
Computes cumulative N(mu,sigma) distribution.
|
static double |
poly(double[] c,
int nord,
double x)
Quoted from the original Fortran documentation:
Calculates the algebraic polynomial of order nord-1 with array of
coefficients c.
|
static double |
ppnd16(double p)
Quoted from original Fortran documentation:
Produces the normal deviate Z corresponding to a given lower
tail area of P; Z is accurate to about 1 part in 10**16.
|
static double[] |
testroyston(double[] x)
This method computes the statistic and the p-value of Shapiro Wilk test using Royston algorithm.
|
static double[] |
testsw(double[][][] err,
double significance,
java.io.PrintStream p)
Computes the p-value of Shapiro Wilk statistical test for a set of samples obtained from
two algorithms and an arbitrary number of datasets
|
static double[] |
wcoef(int n,
int n2)
Obtains an array of weights for calculating Shapiro Wilk statistic
Translated from Fortran to C and from C to Java.
|
public static final int Dietterich5x2cvR
public static final int Dietterich5x2cvC
public static final int tR
public static final int tC
public static final int ShapiroWilkR
public static final int ShapiroWilkC
public static final int WilcoxonR
public static final int WilcoxonC
public static final int MannWhitneyR
public static final int MannWhitneyC
public static final int fM
public static final int fC
public static final int summaryC
public static final int summaryR
public static final int generalC
public static final int generalR
public static final int tabularC
public static final int tabularR
public static final int trainTestR
public static final int trainTestC
public static final int globalWilcoxonC
public static final int globalWilcoxonR
public static final int FriedmanC
public static final int FriedmanR
public static final int FriedmanAlignedC
public static final int FriedmanAlignedR
public static final int QuadeC
public static final int QuadeR
public static final int ContrastC
public static final int ContrastR
public static final int MultipleC
public static final int MultipleR
public static final int summaryI
public static final int generalI
public static final int tabularI
public static final int globalWilcoxonI
public static final int FriedmanI
public StatTest(int selector, double[][][][] d, double[][][][] dtrain, double significance, java.lang.String nres, java.lang.String nameRel, java.util.Vector nameResults, java.lang.String[] labels)
This method calls the selected statistical test or output module.
selector
- An int that selects the statistical test or module to be applied. The relationship
value / statistical test or output module is done via the public final static variables defined at
the beginning of this classd
- A cubic matrix with samples values indexed by algorithm, fold and datasetdtrain
- Train datasignificance
- 1-level of the statistical testnres
- Output file namenameRel
- Algorithms namesnameResults
- Results nameslabels
- Class labelspublic static double alnorm(double x, int upper)
Quoted from original Fortran documentation: Evaluates the tail area of the standardised normal curve from x to infinity if upper is true or from minus infinity to x if upper is false. Translated from Fortran to C and from C to Java. Original code published in Applied Statistics (1973) vol22 no.3 Algorithm AS66
x
- x valueupper
- an int used as a booleanpublic static double ppnd16(double p)
Quoted from original Fortran documentation: Produces the normal deviate Z corresponding to a given lower tail area of P; Z is accurate to about 1 part in 10**16. Translated from Fortran to C and from C to Java. Original code published in Applied Statistics (1988) vol37 no. 3 Algorithm AS241
p
- Area valuepublic static double[] nscor2(int n, int n2)
Quoted from original Fortran documentation: Calculates approximate expected values of normal order statistics. Translated from Fortran to C and from C to Java. Original code published in Applied Statistics 1982) Vol.31, No.2 Algorithm 177.3
n
- The sample sizen2
- The number of order statistics required; must be <= n/2public static double correc(int i, int n)
Quoted from original Fortran documentation: Calculates correction for tail area of the i-th largest of n order statistics. Translated from Fortran to C and from C to Java. Original code published in Applied Statistics (1982) Vol.31, No.2 Algorithm 177.4
i
- ith largest rankingn
- Sample sizepublic static double[] wcoef(int n, int n2)
Obtains an array of weights for calculating Shapiro Wilk statistic Translated from Fortran to C and from C to Java. Original code published in Appl. Statist. (1982) Vol. 31, No. 2 Algorithm AS 181.1
n
- The sample sizen2
- The number of order statistics required; must be <= n/2public static double poly(double[] c, int nord, double x)
Quoted from the original Fortran documentation: Calculates the algebraic polynomial of order nord-1 with array of coefficients c. Zero order coefficient is c(1) Translated from Fortran to C and from C to Java. Original code published in Appl. Statist. (1982) Vol. 31, No. 2 Algorithm AS 181.2
c
- Vector of coefficientsnord
- order of the polinomial + 1x
- x valuepublic static double[] testroyston(double[] x)
This method computes the statistic and the p-value of Shapiro Wilk test using Royston algorithm. Part of the code was translated from Fortran to C and from C to Java, finally encapsulated in this method calling other 181.x Algorithms. Original code published in Appl. Statist. (1982) Vol. 31, No. 2 Algorithm AS 181
x
- Vector with sample values.public static double[] testsw(double[][][] err, double significance, java.io.PrintStream p)
Computes the p-value of Shapiro Wilk statistical test for a set of samples obtained from two algorithms and an arbitrary number of datasets
err
- A cubic matrix with the samples values indexed by algorithm, fold and datasetsignificance
- 1-level of the testp
- Output stream for tracing purposespublic static double lnfgamma(double c)
Computes natural logarithm of the gamma function. Based on the code in "Numerical Recipes in C"
c
- The argument of the gamma functionpublic static double lnfbeta(double a, double b)
Computes natural logarithm of the beta function.
a
- The first argument of the beta functionb
- The second argument of the beta functionpublic static double betainv(double x, double p, double q)
Quoted from original Fortran documentation: Computes incomplete beta function ratio for arguments x between zero and one, p and q positive. log of complete beta function, beta, is assumed to be known Original code published in Applied Statistics Vol32, No.1 Algorithm AS 63
x
- x valuep
- The first argument of the beta functionq
- The second argument of the beta functionpublic static double pf(double x, double df1, double df2)
Computes cumulative Snedecor F distribution
x
- x valuedf1
- Numerator degrees of freedomdf2
- Denominator degrees of freedompublic static double pnorm(double z, boolean upper)
Computes cumulative N(0,1) distribution. Based om Algorithm AS66 Applied Statistics (1973) vol22 no.3
z
- x valueupper
- A boolean value, if true the integral is evaluated from z to infinity, from minus infinity to z otherwisepublic static double pnorm(double x, boolean upper, double mu, double sigma2)
Computes cumulative N(mu,sigma) distribution.
x
- x valueupper
- A boolean value, if true the integral is evaluated from z to infinity, from minus infinity to z otherwisemu
- The mean of the distributionsigma2
- The variance of the distribution