|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.fasteasytrade.JRandTest.Tests.Base
Base class for all test classes.
Contains common methods and handle input/output list of listeners.
Nested Class Summary | |
class |
Base.point
|
Field Summary | |
static DecimalFormat |
df
|
int |
DIM
|
double |
PI
|
(package private) RandomStream |
rs
|
long |
UNIMAX
|
(package private) Vector |
vecOutputDestinations
|
Constructor Summary | |
Base()
|
Method Summary | |
double |
ABS(double a)
|
int |
ABS(int a)
|
private double |
AD(double z)
c.d.f of Anderson-Darling statistic (a quick algorithm) Used by KStest |
void |
addOutputDestination(OutputDestination od)
register output destination in vector of output destinations. printf and puts willwrite data to all destinations. |
static double |
avg(double[] data)
|
double |
chisq(int df,
double x)
p.d.f of Chi-square |
double |
Chisq(int df,
double x)
c.d.f of Chi-square |
static double |
chitest(double[] data,
double expected)
|
boolean |
closeInputStream()
open registered RandomStream. |
String |
d4(double d)
Returns double as string 10.4: zzzzz.dddd. |
double |
d4d_d(double d)
|
String |
d4d(double d)
|
double |
exp(double a)
|
double |
exp(int a)
|
double |
G(double z)
gamma(z) when 2z is a integer |
void |
help()
help method to be implemented by each test class. |
boolean |
isOpen()
checks if input random stream is open. |
double |
KStest(double[] x,
int dim)
KStest This test is based on a modified Kolmogorov-Smirnov method. |
double |
log(double a)
|
double |
MAX(double a,
double b)
|
int |
MAX(int a,
int b)
|
double |
MIN(double a,
double b)
|
int |
MIN(int a,
int b)
|
boolean |
openInputStream()
open registered RandomStream. |
double |
phi(double x)
p.d.f of Standard Normal |
double |
Phi(double x)
c.d.f of Standard Normal |
double[] |
Poisson_fit(double lambda,
int[] obs,
int no_obs)
computes the statistic of goodness of fit to a Poisson distribution |
double |
Poisson(double lambda,
int k)
p.d.f of Poisson distribution |
double |
pow(double a,
double b)
|
void |
printf(String s)
printf on all output destinations registered into vector output destinations. |
void |
puts(String s)
puts - use printf |
void |
qsort(Base.point[] arr,
int dim)
Bubble sort array of points (of class point), |
void |
qsort(double[] arr,
int dim)
Bubble sort array |
void |
qsort(int[] arr,
int dim)
Bubble sort array |
static double |
r2_double(double[] data)
|
double |
read32BitsAsDouble()
read one int from registered input random stream and divide it by (2^32 - 1). |
byte |
readByte()
read one byte from registered input random stream. |
int |
readInt()
read one byte from registered input random stream. |
long |
readLong()
read one long from registered input random stream. |
void |
registerInput(RandomStream rs)
register RandomStream interface. |
void |
removeOutputDestination(OutputDestination od)
unregister output destination from vector of output destinations. |
void |
showbit(int n)
show the bit-pattern of an integer 32 bits |
double |
SIGN(double a)
|
int |
SIGN(int a)
|
double |
sqrt(double a)
|
double |
sqrt(int a)
|
static double |
stdev(double[] data,
double avg)
Returns double Standard Deviation |
void |
test(String filename)
test method to be implemented by each test class. |
int |
uni()
Use readInt method. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public final double PI
public final int DIM
public final long UNIMAX
public static DecimalFormat df
Vector vecOutputDestinations
RandomStream rs
Constructor Detail |
public Base()
Method Detail |
public double MAX(double a, double b)
public int MAX(int a, int b)
public double MIN(double a, double b)
public int MIN(int a, int b)
public double ABS(double a)
public int ABS(int a)
public double SIGN(double a)
public int SIGN(int a)
public double pow(double a, double b)
public double sqrt(double a)
public double sqrt(int a)
public double exp(double a)
public double exp(int a)
public double log(double a)
public void qsort(double[] arr, int dim)
arr
- is a double arraydim
- only first dim entries are sorted in array arr. So part of the
array can be sorted.public void qsort(int[] arr, int dim)
arr
- is an int arraydim
- only first dim entries are sorted in array arr. So part of the
array can be sorted.public void qsort(Base.point[] arr, int dim)
arr
- is a point arraydim
- only first dim entries are sorted in array arr. So part of the
array can be sorted.public double d4d_d(double d)
public String d4d(double d)
public String d4(double d)
d
- double number
public double G(double z)
public double phi(double x)
public double Phi(double x)
public double chisq(int df, double x)
public double Chisq(int df, double x)
public double Poisson(double lambda, int k)
public static double chitest(double[] data, double expected)
public static double stdev(double[] data, double avg)
data
- array of doublesavg
- avg of data arraypublic static double r2_double(double[] data)
public double[] Poisson_fit(double lambda, int[] obs, int no_obs)
public static double avg(double[] data)
data
- input array of doubles
public void printf(String s)
public void puts(String s)
public void showbit(int n)
public void addOutputDestination(OutputDestination od)
od
- register this OutputDestination interfacepublic void removeOutputDestination(OutputDestination od)
od
- OutputDestination interface to be removedpublic void registerInput(RandomStream rs)
Supports only one random stream.
rs
- register radom stream interfacepublic boolean isOpen()
random stream isOpen method is used to return boolean.
public boolean openInputStream()
public boolean closeInputStream()
public byte readByte()
public int readInt()
public long readLong()
public int uni()
public double read32BitsAsDouble()
public double KStest(double[] x, int dim)
This test is based on a modified Kolmogorov-Smirnov method.
The test-statistic is (FN(X)-X)**2/(X*(1-X)) (Anderson-Darling) where X is a uniform under null hypothesis. FN(X) is the empirical distribution of X.
private double AD(double z)
Used by KStest
public void help()
public void test(String filename) throws Exception
filename
- is the filename to be read or the algorithm name.
Exception
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |