24 void fitLinearRobust()
35 for (i=0; i<fraction; i++){
39 y[i]=1 + 2*x[i] + 3*x[i]*x[i] + 4*x[i]*x[i]*x[i] + e[i]*r.
Gaus();
41 for (i=fraction; i<npoints; i++){
45 y[i] = 1 + 2*x[i] + 3*x[i]*x[i] + 4*x[i]*x[i]*x[i] + r.
Landau(10, 5);
51 TF1 *ffit1 =
new TF1(
"ffit1",
"pol3", -5, 5);
52 TF1 *ffit2 =
new TF1(
"ffit2",
"pol3", -5, 5);
55 TCanvas *myc =
new TCanvas(
"myc",
"Linear and robust linear fitting");
59 printf(
"Ordinary least squares:\n");
64 printf(
"Resistant Least trimmed squares fit:\n");
71 grr->
Fit(ffit2,
"+rob=0.75");
74 leg->
AddEntry(ffit1,
"Ordinary least squares",
"l");
75 leg->
AddEntry(ffit2,
"LTS regression",
"l");
virtual TFitResultPtr Fit(const char *formula, Option_t *option="", Option_t *goption="", Axis_t xmin=0, Axis_t xmax=0)
Fit this graph with function with name fname.
This class displays a legend box (TPaveText) containing several legend entries.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
virtual void SetMinimum(Double_t minimum=-1111)
Set the minimum of the graph.
virtual void Draw(Option_t *option="")
Draw this legend with its current attributes.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
This is the base class for the ROOT Random number generators.
virtual void SetGrid(Int_t valuex=1, Int_t valuey=1)
virtual void SetMaximum(Double_t maximum=-1111)
Set the maximum of the graph.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
TLegendEntry * AddEntry(const TObject *obj, const char *label="", Option_t *option="lpf")
Add a new entry to this legend.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
A TGraphErrors is a TGraph with error bars.
virtual Double_t Landau(Double_t mean=0, Double_t sigma=1)
Generate a random number following a Landau distribution with location parameter mu and scale paramet...