#include <xmath.h>
|
static void | ChiSquareOne (const TFltV &ObservedBinV, const TFltV &ExpectedBinV, double &ChiSquareVal, double &SignificancePrb) |
|
static void | ChiSquareTwo (const TFltV &ObservedBin1V, const TFltV &ObservedBin2V, double &ChiSquareVal, double &SignificancePrb) |
|
static void | TTest (const TFltV &ValV1, const TFltV &ValV2, double &TTestVal, double &TTestPrb) |
|
static void | KsTest (const TFltV &ValV1, const TFltV &ValV2, double &DStat, double &PVal) |
|
static void | KsTest (const TFltPrV &ValCntV1, const TFltPrV &ValCntV2, double &DStat, double &PVal) |
|
|
static void | AveVar (const TFltV &ValV, double &Ave, double &Var) |
|
static double | KsProb (const double &Alam) |
|
Definition at line 294 of file xmath.h.
void TStatTest::AveVar |
( |
const TFltV & |
ValV, |
|
|
double & |
Ave, |
|
|
double & |
Var |
|
) |
| |
|
staticprivate |
Definition at line 590 of file xmath.cpp.
References TVec< TVal, TSizeTy >::Len().
592 for (
int ValN=0; ValN<ValV.
Len(); ValN++){
597 for (
int ValN=0; ValN<ValV.
Len(); ValN++){
598 double s=ValV[ValN]-Ave;
602 Var=(Var-ep*ep/ValV.
Len())/(ValV.
Len()-1);
TSizeTy Len() const
Returns the number of elements in the vector.
void TStatTest::ChiSquareOne |
( |
const TFltV & |
ObservedBinV, |
|
|
const TFltV & |
ExpectedBinV, |
|
|
double & |
ChiSquareVal, |
|
|
double & |
SignificancePrb |
|
) |
| |
|
static |
Definition at line 620 of file xmath.cpp.
References TSpecFunc::GammaQ(), IAssert, and TVec< TVal, TSizeTy >::Len().
624 int Bins=ObservedBinV.
Len();
626 int DegreesOfFreedom=Bins-Constraints;
628 for (
int BinN=0; BinN<Bins; BinN++){
630 double BinDiff=ObservedBinV[BinN]-ExpectedBinV[BinN];
631 ChiSquareVal+=BinDiff*BinDiff/ExpectedBinV[BinN];
TSizeTy Len() const
Returns the number of elements in the vector.
static double GammaQ(const double &a, const double &x)
void TStatTest::ChiSquareTwo |
( |
const TFltV & |
ObservedBin1V, |
|
|
const TFltV & |
ObservedBin2V, |
|
|
double & |
ChiSquareVal, |
|
|
double & |
SignificancePrb |
|
) |
| |
|
static |
Definition at line 637 of file xmath.cpp.
References TSpecFunc::GammaQ(), IAssert, and TVec< TVal, TSizeTy >::Len().
641 int Bins=ObservedBin1V.
Len();
643 int DegreesOfFreedom=Bins-Constraints;
645 for (
int BinN=0; BinN<Bins; BinN++){
646 if ((ObservedBin1V[BinN]==0.0) && (ObservedBin2V[BinN]==0.0)){
649 double BinDiff=ObservedBin1V[BinN]-ObservedBin2V[BinN];
650 ChiSquareVal+=BinDiff*BinDiff/(ObservedBin1V[BinN]+ObservedBin2V[BinN]);
TSizeTy Len() const
Returns the number of elements in the vector.
static double GammaQ(const double &a, const double &x)
double TStatTest::KsProb |
( |
const double & |
Alam | ) |
|
|
staticprivate |
Definition at line 605 of file xmath.cpp.
Referenced by KsTest().
606 const double EPS1 = 0.001;
607 const double EPS2 = 1.0e-8;
608 double a2 = -2.0*Alam*Alam, fac = 2.0, sum = 0.0, term, termbf = 0.0;
609 for (
int j=1; j <= 100; j++) {
610 term = fac*exp(a2*j*j);
612 if (fabs(term) <= EPS1*termbf || fabs(term) <= EPS2*sum)
void TStatTest::KsTest |
( |
const TFltV & |
ValV1, |
|
|
const TFltV & |
ValV2, |
|
|
double & |
DStat, |
|
|
double & |
PVal |
|
) |
| |
|
static |
Definition at line 678 of file xmath.cpp.
References IAssert, TVec< TVal, TSizeTy >::IsSorted(), KsProb(), TVec< TVal, TSizeTy >::Len(), and TMath::Mx().
681 double CumSum1=0.0, CumSum2=0.0, Cdf1=0.0, Cdf2=0.0;
682 const double N1 = ValV1.
Len();
683 const double N2 = ValV2.
Len();
684 if (! (N1 > 0.0 && N2 > 0.0)) { DStat = 1.0; PVal = 0.0;
return; }
686 while (i1 < ValV1.
Len() && i2 < ValV2.
Len()) {
687 const double X1 = ValV1[i1];
688 const double X2 = ValV2[i2];
691 Cdf1 = (CumSum1 / N1);
696 Cdf2 = (CumSum2 / N2);
699 DStat =
TMath::Mx(DStat, fabs(Cdf1 - Cdf2));
701 const double En = sqrt( N1*N2 / (N1+N2));
static const T & Mx(const T &LVal, const T &RVal)
static double KsProb(const double &Alam)
TSizeTy Len() const
Returns the number of elements in the vector.
bool IsSorted(const bool &Asc=true) const
Checks whether the vector is sorted in ascending (if Asc=true) or descending (if Asc=false) order...
void TStatTest::KsTest |
( |
const TFltPrV & |
ValCntV1, |
|
|
const TFltPrV & |
ValCntV2, |
|
|
double & |
DStat, |
|
|
double & |
PVal |
|
) |
| |
|
static |
Definition at line 705 of file xmath.cpp.
References IAssert, TVec< TVal, TSizeTy >::IsSorted(), KsProb(), TVec< TVal, TSizeTy >::Len(), and TMath::Mx().
708 double N1=0.0, N2=0.0, CumSum1=0.0, CumSum2=0.0, Cdf1=0.0, Cdf2=0.0;
710 for (
int i = 0; i < ValCntV1.
Len(); i++) N1 += ValCntV1[i].Val2;
711 for (
int i = 0; i < ValCntV2.
Len(); i++) N2 += ValCntV2[i].Val2;
712 if (! (N1 > 0.0 && N2 > 0.0)) { DStat = 1.0; PVal = 0.0;
return; }
714 while (i1 < ValCntV1.
Len() && i2 < ValCntV2.
Len()) {
715 const double X1 = ValCntV1[i1].Val1;
716 const double X2 = ValCntV2[i2].Val1;
718 CumSum1 += ValCntV1[i1].Val2;
719 Cdf1 = (CumSum1 / N1);
723 CumSum2 += ValCntV2[i2].Val2;
724 Cdf2 = (CumSum2 / N2);
727 DStat =
TMath::Mx(DStat, fabs(Cdf1 - Cdf2));
729 const double En = sqrt( N1*N2 / (N1+N2));
static const T & Mx(const T &LVal, const T &RVal)
static double KsProb(const double &Alam)
TSizeTy Len() const
Returns the number of elements in the vector.
bool IsSorted(const bool &Asc=true) const
Checks whether the vector is sorted in ascending (if Asc=true) or descending (if Asc=false) order...
void TStatTest::TTest |
( |
const TFltV & |
ValV1, |
|
|
const TFltV & |
ValV2, |
|
|
double & |
TTestVal, |
|
|
double & |
TTestPrb |
|
) |
| |
|
static |
Definition at line 657 of file xmath.cpp.
References TSpecFunc::BetaI(), TVec< TVal, TSizeTy >::Len(), TMom::New(), and TMath::Sqr().
666 double ave1=Val1Mom->GetMean();
667 double ave2=Val2Mom->GetMean();
668 double var1=Val1Mom->GetVari();
669 double var2=Val2Mom->GetVari();
673 TTestVal=(ave1-ave2)/sqrt(var1/n1+var2/n2);
TSizeTy Len() const
Returns the number of elements in the vector.
static double Sqr(const double &x)
static double BetaI(const double &a, const double &b, const double &x)
The documentation for this class was generated from the following files: