00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROOT_TRobustEstimator
00017 #define ROOT_TRobustEstimator
00018
00019 #include "TArrayI.h"
00020 #include "TMatrixDSym.h"
00021 #include "TMatrixDSymEigen.h"
00022
00023 class TRobustEstimator : public TObject {
00024
00025 protected:
00026
00027 Int_t fNvar;
00028 Int_t fH;
00029 Int_t fN;
00030
00031 Int_t fVarTemp;
00032 Int_t fVecTemp;
00033
00034 Int_t fExact;
00035
00036 TVectorD fMean;
00037 TMatrixDSym fCovariance;
00038 TMatrixDSym fInvcovariance;
00039 TMatrixDSym fCorrelation;
00040 TVectorD fRd;
00041 TVectorD fSd;
00042 TArrayI fOut;
00043 TVectorD fHyperplane;
00044
00045
00046 TMatrixD fData;
00047
00048
00049
00050 void AddToSscp(TMatrixD &sscp, TVectorD &vec);
00051 void ClearSscp(TMatrixD &sscp);
00052
00053 void Classic();
00054 void Covar(TMatrixD &sscp, TVectorD &m, TMatrixDSym &cov, TVectorD &sd, Int_t nvec);
00055 void Correl();
00056
00057 void CreateSubset(Int_t ntotal, Int_t htotal, Int_t p, Int_t *index, TMatrixD &data,
00058 TMatrixD &sscp, Double_t *ndist);
00059 void CreateOrtSubset(TMatrixD &dat, Int_t *index, Int_t hmerged, Int_t nmerged, TMatrixD &sscp, Double_t *ndist);
00060
00061 Double_t CStep(Int_t ntotal, Int_t htotal, Int_t *index, TMatrixD &data, TMatrixD &sscp, Double_t *ndist);
00062
00063 Int_t Exact(Double_t *ndist);
00064 Int_t Exact2(TMatrixD &mstockbig, TMatrixD &cstockbig, TMatrixD &hyperplane,
00065 Double_t *deti, Int_t nbest,Int_t kgroup,
00066 TMatrixD &sscp, Double_t *ndist);
00067
00068 Int_t Partition(Int_t nmini, Int_t *indsubdat);
00069 Int_t RDist(TMatrixD &sscp);
00070 void RDraw(Int_t *subdat, Int_t ngroup, Int_t *indsubdat);
00071
00072 Double_t KOrdStat(Int_t ntotal, Double_t *arr, Int_t k, Int_t *work);
00073
00074 public:
00075
00076 TRobustEstimator();
00077 TRobustEstimator(Int_t nvectors, Int_t nvariables, Int_t hh=0);
00078 virtual ~TRobustEstimator(){;}
00079
00080 void AddColumn(Double_t *col);
00081 void AddRow(Double_t *row);
00082
00083 void Evaluate();
00084 void EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh=0);
00085
00086 Int_t GetBDPoint();
00087
00088 void GetCovariance(TMatrixDSym &matr);
00089 const TMatrixDSym* GetCovariance() const{return &fCovariance;}
00090 void GetCorrelation(TMatrixDSym &matr);
00091 const TMatrixDSym* GetCorrelation() const{return &fCorrelation;}
00092 void GetHyperplane(TVectorD &vec);
00093 const TVectorD* GetHyperplane() const;
00094 Int_t GetNHyp() {return fExact;}
00095 void GetMean(TVectorD &means);
00096 const TVectorD* GetMean() const {return &fMean;}
00097 void GetRDistances(TVectorD &rdist);
00098 const TVectorD* GetRDistances() const {return &fRd;}
00099 Int_t GetNumberObservations() const {return fN;}
00100 Int_t GetNvar() const {return fNvar;}
00101 const TArrayI* GetOuliers() const{return &fOut;}
00102 Int_t GetNOut();
00103
00104
00105 Double_t GetChiQuant(Int_t i) const;
00106
00107 ClassDef(TRobustEstimator,1)
00108
00109 };
00110
00111
00112 #endif
00113