File indexing completed on 2025-01-18 10:12:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef ROOT_TRobustEstimator
0017 #define ROOT_TRobustEstimator
0018
0019 #include "TArrayI.h"
0020 #include "TMatrixDSym.h"
0021 #include "TVectorD.h"
0022
0023 class TRobustEstimator : public TObject {
0024
0025 protected:
0026
0027 Int_t fNvar;
0028 Int_t fH;
0029 Int_t fN;
0030
0031 Int_t fVarTemp;
0032 Int_t fVecTemp;
0033
0034 Int_t fExact;
0035
0036 TVectorD fMean;
0037 TMatrixDSym fCovariance;
0038 TMatrixDSym fInvcovariance;
0039 TMatrixDSym fCorrelation;
0040 TVectorD fRd;
0041 TVectorD fSd;
0042 TArrayI fOut;
0043 TVectorD fHyperplane;
0044
0045
0046 TMatrixD fData;
0047
0048
0049
0050 void AddToSscp(TMatrixD &sscp, TVectorD &vec);
0051 void ClearSscp(TMatrixD &sscp);
0052
0053 void Classic();
0054 void Covar(TMatrixD &sscp, TVectorD &m, TMatrixDSym &cov, TVectorD &sd, Int_t nvec);
0055 void Correl();
0056
0057 void CreateSubset(Int_t ntotal, Int_t htotal, Int_t p, Int_t *index, TMatrixD &data,
0058 TMatrixD &sscp, Double_t *ndist);
0059 void CreateOrtSubset(TMatrixD &dat, Int_t *index, Int_t hmerged, Int_t nmerged, TMatrixD &sscp, Double_t *ndist);
0060
0061 Double_t CStep(Int_t ntotal, Int_t htotal, Int_t *index, TMatrixD &data, TMatrixD &sscp, Double_t *ndist);
0062
0063 Int_t Exact(Double_t *ndist);
0064 Int_t Exact2(TMatrixD &mstockbig, TMatrixD &cstockbig, TMatrixD &hyperplane,
0065 Double_t *deti, Int_t nbest,Int_t kgroup,
0066 TMatrixD &sscp, Double_t *ndist);
0067
0068 Int_t Partition(Int_t nmini, Int_t *indsubdat);
0069 Int_t RDist(TMatrixD &sscp);
0070 void RDraw(Int_t *subdat, Int_t ngroup, Int_t *indsubdat);
0071
0072 Double_t KOrdStat(Int_t ntotal, Double_t *arr, Int_t k, Int_t *work);
0073
0074 public:
0075
0076 TRobustEstimator();
0077 TRobustEstimator(Int_t nvectors, Int_t nvariables, Int_t hh=0);
0078 ~TRobustEstimator() override {}
0079
0080 void AddColumn(Double_t *col);
0081 void AddRow(Double_t *row);
0082
0083 void Evaluate();
0084 void EvaluateUni(Int_t nvectors, Double_t *data, Double_t &mean, Double_t &sigma, Int_t hh=0);
0085
0086 Int_t GetBDPoint();
0087
0088
0089 const TMatrixD & GetData() { return fData; }
0090
0091 void GetCovariance(TMatrixDSym &matr);
0092 const TMatrixDSym* GetCovariance() const{return &fCovariance;}
0093 void GetCorrelation(TMatrixDSym &matr);
0094 const TMatrixDSym* GetCorrelation() const{return &fCorrelation;}
0095 void GetHyperplane(TVectorD &vec);
0096 const TVectorD* GetHyperplane() const;
0097 Int_t GetNHyp() {return fExact;}
0098 void GetMean(TVectorD &means);
0099 const TVectorD* GetMean() const {return &fMean;}
0100 void GetRDistances(TVectorD &rdist);
0101 const TVectorD* GetRDistances() const {return &fRd;}
0102 Int_t GetNumberObservations() const {return fN;}
0103 Int_t GetNvar() const {return fNvar;}
0104 const TArrayI* GetOuliers() const{return &fOut;}
0105 Int_t GetNOut();
0106
0107
0108 Double_t GetChiQuant(Int_t i) const;
0109
0110 ClassDefOverride(TRobustEstimator,1)
0111
0112 };
0113
0114
0115 #endif
0116