31 void DrawSmooth(Int_t pad,
const char *title,
const char *xt,
const char *yt)
34 TH1F *vFrame = gPad->DrawFrame(0,-130,60,70);
35 vFrame->SetTitle(title);
36 vFrame->SetTitleSize(0.2);
37 vFrame->SetXTitle(xt);
38 vFrame->SetYTitle(yt);
40 grout->DrawClone(
"LPX");
46 TString dir = gROOT->GetTutorialDir();
47 dir.Append(
"/graphs/");
48 dir.ReplaceAll(
"/./",
"/");
51 Double_t *x =
new Double_t[133];
52 Double_t *y =
new Double_t[133];
56 vInput.open(Form(
"%smotorcycle.dat",dir.Data()));
59 if (!vInput.good())
break;
65 grin =
new TGraph(vNData,x,y);
68 vC1 =
new TCanvas(
"vC1",
"Smooth Regression",200,10,900,700);
73 TGraphSmooth *gs =
new TGraphSmooth(
"normal");
74 grout = gs->SmoothKern(grin,
"normal",2.0);
75 DrawSmooth(1,
"Kernel Smoother: bandwidth = 2.0",
"times",
"accel");
78 grout = gs->SmoothKern(grin,
"normal",5.0);
79 DrawSmooth(2,
"Kernel Smoother: bandwidth = 5.0",
"",
"");
83 grout = gs->SmoothLowess(grin,
"",0.67);
84 DrawSmooth(3,
"Lowess: f = 2/3",
"",
"");
87 grout = gs->SmoothLowess(grin,
"",0.2);
88 DrawSmooth(4,
"Lowess: f = 0.2",
"",
"");
92 grout = gs->SmoothSuper(grin,
"",0,0);
93 DrawSmooth(5,
"Super Smoother: bass = 0",
"",
"");
96 grout = gs->SmoothSuper(grin,
"",3);
97 DrawSmooth(6,
"Super Smoother: bass = 3",
"",
"");