sugr.test
Class TestStatistics

java.lang.Object
  extended bysugr.test.TestStatistics

public class TestStatistics
extends java.lang.Object

Compute statistics to test covariance matrices.

Author:
Thomas Laebe, ipb

Constructor Summary
TestStatistics(int size)
          Construct a new TestStatistics for an Entity.
 
Method Summary
 void addObservation(Element e)
          Add a new observation.
static boolean check(Entity one, Entity two, double precision)
          Checks if two entities contain the same values.
static boolean check(Matrix m1, Matrix m2, double precision)
          This method checks if two Matrices have nearly the same entries No test included if dimensions agree.
static boolean check(Vector vec1, Vector vec2, double precision)
          Checks if two vectors have nearly the same entries.
static boolean check(Vector vec1, Vector vec2, Matrix mat1, Matrix mat2, double precision)
          This method checks if two Vectors and Matrices have nearly the same entries.
static boolean check(Vector vec1, Vector vec2, Matrix mat1, Matrix mat2, double precision, double null_threshold)
          This method checks if two Vectors and Matrices have nearly the same entries.
static boolean checkAbsolute(Matrix m1, Matrix m2, double precision)
          This method checks if two Matrices have nearly the same entries with an absolute difference between the two matrix entries No test included if dimensions agree.
 Vector getMue()
          Get the (empirical) mean value.
static double getNextGauss(double stddev)
           
 Matrix getSigma()
          Get the (empirical) covariance matrix
static void main(java.lang.String[] args)
           
static void test1()
          Example: Test a constructor.
static void test2()
          Test distribution of a randeom value with covariance matrix.
static void test3()
          Test how good the gaussian distribution of the random values is.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestStatistics

public TestStatistics(int size)
Construct a new TestStatistics for an Entity.

Parameters:
size - Size of vector of that Entity.
Method Detail

check

public static boolean check(Vector vec1,
                            Vector vec2,
                            Matrix mat1,
                            Matrix mat2,
                            double precision)
This method checks if two Vectors and Matrices have nearly the same entries. No test included if dimensions agree!

Parameters:
vec1 - to be compared to vec2
vec2 -
mat1 - to be compared to mat2
mat2 -
precision - factor for comparison
Returns:
if vec1,mat1 meet vec2,mat2

check

public static boolean check(Vector vec1,
                            Vector vec2,
                            Matrix mat1,
                            Matrix mat2,
                            double precision,
                            double null_threshold)
This method checks if two Vectors and Matrices have nearly the same entries. No test included if dimensions agree!

Parameters:
vec1 - to be compared to vec2
vec2 -
mat1 - to be compared to mat2
mat2 -
precision - factor for comparison
null_threshold - all differences less than this value are regarded as being 0: ONLY for the matrixes !
Returns:
if vec1,mat1 meet vec2,mat2

check

public static boolean check(Matrix m1,
                            Matrix m2,
                            double precision)
This method checks if two Matrices have nearly the same entries No test included if dimensions agree.

Parameters:
m1 - to be compared to m2
m2 -
precision - factor for comparison
Returns:
if m1 meets m2

checkAbsolute

public static boolean checkAbsolute(Matrix m1,
                                    Matrix m2,
                                    double precision)
This method checks if two Matrices have nearly the same entries with an absolute difference between the two matrix entries No test included if dimensions agree.

Parameters:
m1 - to be compared to m2
m2 -
precision - factor for comparison
Returns:
if m1 meets m2

check

public static boolean check(Vector vec1,
                            Vector vec2,
                            double precision)
Checks if two vectors have nearly the same entries. No test included if dimensions agree!

Parameters:
vec1 - to be compared to vec2
vec2 -
precision - factor for comparison
Returns:
if vec1 meets vec2

check

public static boolean check(Entity one,
                            Entity two,
                            double precision)
Checks if two entities contain the same values. Uses check method for vector and covaciance.

Parameters:
one - - first entity
two - - second entity
precision - - precision factor for comparison
Returns:
one == two

addObservation

public void addObservation(Element e)
Add a new observation. The vector of the observation is stored.

Parameters:
e - the new observation.

getMue

public Vector getMue()
Get the (empirical) mean value.


getSigma

public Matrix getSigma()
Get the (empirical) covariance matrix


main

public static void main(java.lang.String[] args)

test1

public static void test1()
Example: Test a constructor.


test3

public static void test3()
Test how good the gaussian distribution of the random values is.


test2

public static void test2()
Test distribution of a randeom value with covariance matrix.


getNextGauss

public static double getNextGauss(double stddev)