Logo ROOT  
Reference Guide
TGraphSmooth.h
Go to the documentation of this file.
1 // @(#)root/hist:$Id$
2 // Author: Christian Stratowa 30/09/2001
3 
4 /******************************************************************************
5 * Copyright(c) 2001- , Dr. Christian Stratowa, Vienna, Austria. *
6 * Author: Christian Stratowa with help from Rene Brun. *
7 * *
8 * Algorithms for smooth regression adapted from: *
9 * R: A Computer Language for Statistical Data Analysis *
10 * Copyright (C) 1996 Robert Gentleman and Ross Ihaka *
11 * Copyright (C) 1999-2001 Robert Gentleman, Ross Ihaka and the *
12 * R Development Core Team *
13 * R is free software, for licensing see the GNU General Public License *
14 * http://www.ci.tuwien.ac.at/R-project/welcome.html *
15 * *
16 * Based on: "The ROOT System", All rights reserved. *
17 * Authors: Rene Brun and Fons Rademakers. *
18 * For the licensing terms of "The ROOT System" see $ROOTSYS/AA_LICENSE. *
19 * For the list of contributors to "The ROOT System" see $ROOTSYS/AA_CREDITS. *
20 ******************************************************************************/
21 
22 #ifndef ROOT_TGraphSmooth
23 #define ROOT_TGraphSmooth
24 
25 //////////////////////////////////////////////////////////////////////////
26 // //
27 // TGraphSmooth //
28 // //
29 // Class for different regression smoothers //
30 // //
31 //////////////////////////////////////////////////////////////////////////
32 
33 #include "TGraph.h"
34 
35 
36 class TGraphSmooth: public TNamed {
37 
38 private:
39  TGraphSmooth(const TGraphSmooth&); // Not implented
40  TGraphSmooth& operator=(const TGraphSmooth&); // Not implented
41 
42 protected:
43  Int_t fNin; //Number of input points
44  Int_t fNout; //Number of output points
45  TGraph *fGin; //Input graph
46  TGraph *fGout; //Output graph
47  Double_t fMinX; //Minimum value of array X
48  Double_t fMaxX; //Maximum value of array X
49 
50 public :
51  TGraphSmooth();
52  TGraphSmooth(const char *name);
53 // TGraphSmooth(const TGraphSmooth &smoothReg); //??
54  virtual ~TGraphSmooth();
55 
56  TGraph *Approx(TGraph *grin, Option_t *option="linear", Int_t nout=50, Double_t *xout=0,
57  Double_t yleft=0, Double_t yright=0, Int_t rule=0, Double_t f=0, Option_t *ties="mean");
58  TGraph *SmoothKern(TGraph *grin, Option_t *option="normal", Double_t bandwidth=0.5, Int_t nout=100, Double_t *xout=0);
59  TGraph *SmoothLowess(TGraph *grin, Option_t *option="",Double_t span=0.67, Int_t iter = 3, Double_t delta = 0);
60  TGraph *SmoothSuper(TGraph *grin, Option_t *option="", Double_t bass = 0, Double_t span=0, Bool_t isPeriodic = kFALSE, Double_t *w=0);
61 
62  void Approxin(TGraph *grin, Int_t iKind, Double_t &Ylow, Double_t &Yhigh, Int_t rule, Int_t iTies);
63  void Smoothin(TGraph *grin);
65  void Lowess(Double_t *x, Double_t *y, Int_t n, Double_t *ys, Double_t span, Int_t iter, Double_t delta);
66  static void Lowest(Double_t *x, Double_t *y, Int_t n, Double_t &xs,
67  Double_t &ys, Int_t nleft, Int_t nright, Double_t *w, Bool_t userw, Double_t *rw, Bool_t &ok);
68  static Int_t Rcmp(Double_t x, Double_t y);
69  static void Psort(Double_t *x, Int_t n, Int_t k);
70  static void Rank(Int_t n, Double_t *a, Int_t *index, Int_t *rank, Bool_t down=kTRUE);
71  static void BDRksmooth(Double_t *x, Double_t *y, Int_t n,
72  Double_t *xp, Double_t *yp, Int_t np, Int_t kernel, Double_t bw);
73  static void BDRsupsmu(Int_t n, Double_t *x, Double_t *y, Double_t *w, Int_t iper,
74  Double_t span, Double_t alpha, Double_t *smo, Double_t *sc);
75  static void BDRsmooth(Int_t n, Double_t *x, Double_t *y, Double_t *w,
76  Double_t span, Int_t iper, Double_t vsmlsq, Double_t *smo, Double_t *acvr);
77 
78  ClassDef(TGraphSmooth,1) //Graph Smoother
79 };
80 
81 #endif
n
const Int_t n
Definition: legend1.C:16
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGraphSmooth::Approxin
void Approxin(TGraph *grin, Int_t iKind, Double_t &Ylow, Double_t &Yhigh, Int_t rule, Int_t iTies)
Sort data points and eliminate double x values.
Definition: TGraphSmooth.cxx:859
f
#define f(i)
Definition: RSha256.hxx:122
TGraphSmooth::fMaxX
Double_t fMaxX
Definition: TGraphSmooth.h:64
TGraph.h
x
Double_t x[n]
Definition: legend1.C:17
TGraphSmooth::Approx
TGraph * Approx(TGraph *grin, Option_t *option="linear", Int_t nout=50, Double_t *xout=0, Double_t yleft=0, Double_t yright=0, Int_t rule=0, Double_t f=0, Option_t *ties="mean")
Approximate data points.
Definition: TGraphSmooth.cxx:998
TGraphSmooth::operator=
TGraphSmooth & operator=(const TGraphSmooth &)
TGraphSmooth::Lowess
void Lowess(Double_t *x, Double_t *y, Int_t n, Double_t *ys, Double_t span, Int_t iter, Double_t delta)
Lowess regression smoother.
Definition: TGraphSmooth.cxx:251
v
@ v
Definition: rootcling_impl.cxx:3635
TGraphSmooth::fNout
Int_t fNout
Definition: TGraphSmooth.h:60
bool
TGraphSmooth::BDRsupsmu
static void BDRsupsmu(Int_t n, Double_t *x, Double_t *y, Double_t *w, Int_t iper, Double_t span, Double_t alpha, Double_t *smo, Double_t *sc)
Friedmanns super smoother (Friedman, 1984).
Definition: TGraphSmooth.cxx:573
TGraphSmooth::BDRksmooth
static void BDRksmooth(Double_t *x, Double_t *y, Int_t n, Double_t *xp, Double_t *yp, Int_t np, Int_t kernel, Double_t bw)
Smooth data with specified kernel.
Definition: TGraphSmooth.cxx:157
TGraphSmooth::Approx1
static Double_t Approx1(Double_t v, Double_t f, Double_t *x, Double_t *y, Int_t n, Int_t iKind, Double_t Ylow, Double_t Yhigh)
Approximate one data point.
Definition: TGraphSmooth.cxx:1060
TGraphSmooth::Rank
static void Rank(Int_t n, Double_t *a, Int_t *index, Int_t *rank, Bool_t down=kTRUE)
static function
Definition: TGraphSmooth.cxx:1126
TGraphSmooth::fGout
TGraph * fGout
Definition: TGraphSmooth.h:62
TGraphSmooth::TGraphSmooth
TGraphSmooth()
Definition: TGraphSmooth.cxx:41
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGraphSmooth::Smoothin
void Smoothin(TGraph *grin)
Sort input data points.
Definition: TGraphSmooth.cxx:77
TGraphSmooth::SmoothSuper
TGraph * SmoothSuper(TGraph *grin, Option_t *option="", Double_t bass=0, Double_t span=0, Bool_t isPeriodic=kFALSE, Double_t *w=0)
Smooth data with Super smoother.
Definition: TGraphSmooth.cxx:482
a
auto * a
Definition: textangle.C:12
TNamed
Definition: TNamed.h:29
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGraphSmooth::SmoothKern
TGraph * SmoothKern(TGraph *grin, Option_t *option="normal", Double_t bandwidth=0.5, Int_t nout=100, Double_t *xout=0)
Smooth data with Kernel smoother.
Definition: TGraphSmooth.cxx:117
TGraphSmooth::Lowest
static void Lowest(Double_t *x, Double_t *y, Int_t n, Double_t &xs, Double_t &ys, Int_t nleft, Int_t nright, Double_t *w, Bool_t userw, Double_t *rw, Bool_t &ok)
Fit value at x[i] Based on R function lowest: Translated to C++ by C.
Definition: TGraphSmooth.cxx:374
y
Double_t y[n]
Definition: legend1.C:17
TGraphSmooth::SmoothLowess
TGraph * SmoothLowess(TGraph *grin, Option_t *option="", Double_t span=0.67, Int_t iter=3, Double_t delta=0)
Smooth data with Lowess smoother.
Definition: TGraphSmooth.cxx:223
TGraphSmooth::fGin
TGraph * fGin
Definition: TGraphSmooth.h:61
Double_t
double Double_t
Definition: RtypesCore.h:59
TGraphSmooth::fMinX
Double_t fMinX
Definition: TGraphSmooth.h:63
TGraph
Definition: TGraph.h:41
TGraphSmooth::Psort
static void Psort(Double_t *x, Int_t n, Int_t k)
Static function based on R function rPsort: adapted to C++ by Christian Stratowa (R source file: R_so...
Definition: TGraphSmooth.cxx:1106
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGraphSmooth::fNin
Int_t fNin
Definition: TGraphSmooth.h:59
name
char name[80]
Definition: TGX11.cxx:110
TGraphSmooth
Definition: TGraphSmooth.h:36
TGraphSmooth::BDRsmooth
static void BDRsmooth(Int_t n, Double_t *x, Double_t *y, Double_t *w, Double_t span, Int_t iper, Double_t vsmlsq, Double_t *smo, Double_t *acvr)
Function for super smoother Based on R function supsmu: Translated to C++ by C.
Definition: TGraphSmooth.cxx:694
TGraphSmooth::Rcmp
static Int_t Rcmp(Double_t x, Double_t y)
Static function if (ISNAN(x)) return 1; if (ISNAN(y)) return -1;.
Definition: TGraphSmooth.cxx:1094
TGraphSmooth::~TGraphSmooth
virtual ~TGraphSmooth()
GraphSmooth destructor.
Definition: TGraphSmooth.cxx:67
int