00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _sampletest_h
00018 #define _sampletest_h
00019
00020 #include <spl/Debug.h>
00021 #include <spl/math/Sample.h>
00022
00031 class SampleTest
00032 {
00033 protected:
00034 Sample m_s1;
00035 Sample m_s2;
00036
00037 static double Betacf(double a, double b, double x);
00038
00039 public:
00040 SampleTest(const Sample& s1, const Sample& s2);
00041 SampleTest(List<double> *s1, List<double> *s2);
00042 SampleTest(Vector<double> *s1, Vector<double> *s2);
00043 SampleTest(const double *s1, const int s1count, const double *s2, const int s2count);
00044 SampleTest(const SampleTest& t);
00045 virtual ~SampleTest();
00046
00047 SampleTest& operator =(const SampleTest& t);
00048
00049 inline Sample& DataSet1() { return m_s1; }
00050 inline Sample& DataSet2() { return m_s2; }
00051
00052 double StudentsT(double *prob);
00053 double FTest(double *fstat);
00054 double ApproximateTTest(double *prob, double *df);
00055 double OneSampleTTest();
00056 double UStat();
00057 double UStatAlternate();
00058
00059 double WTestSmall();
00060 double Levene(double *prob);
00061 double LeveneAlternate(double *prob);
00062
00063 void Rankit(Sample **x1, Sample **x2);
00064
00065 inline double StandardError() const
00066 {
00067 return Math::Sqrt((m_s1.StDevSample() * m_s1.StDevSample()) / m_s1.N() + (m_s2.StDevSample() * m_s2.StDevSample()) / m_s2.N());
00068 }
00069
00070 static double Betai(double a, double b, double x);
00071 static double Gammaln(double xx);
00072 static double Gamma(double d);
00073 static double FDistr(double x, double v, double w);
00074
00075 static double TCriticalValue(int N, double alpha);
00076 static double TCriticalValueAlternate(int N, double alpha);
00077 static double WTestCriticalValue(int N, double alpha);
00078 static double UCriticalPoint(int N1, int N2, double alpha);
00079
00080 #ifdef DEBUG
00081 virtual void ValidateMem () const;
00082 virtual void CheckMem () const;
00083 #endif
00084 };
00085
00088 #endif