Hi Rene,
While trying to do linear fit on a graph using root 4.00/08 and red-hat 7.3
I noticed I am getting large errors for the fit parameters. I found a
reference to a similar problem (see below)
when trying the same code as below, I got the same results of like Voropaev S.G.,
1 p0 6.44571e-01 8.45154e-01 2.18445e-04 -1.48898e-14
2 p1 -1.03577e+00 9.50208e+00 2.45598e-03 -8.82907e-16
Was this problem indeed fixed ?, or am I doing something wrong ?
=================================================================
The e-mail
{
Voropaev S.G. wrote:
>
> Hello,
> I have new problem with fitting unsorted data. I am trying to fit unsorted
> array X,Y to line. I use object TGraph. Parameters of line is well, but error
> is very strange.
> Test macro with only 5 data point. (In real life number of data point is
> larger, but problem still exist):
>
> Result of fitting: p0 = 0.64 +- 0.85 !, p1 = -1.04 +- 9.5 !!!
>
> Where is error? It is my error or not?
>
> I use ROOT 1.02/00 1 august 1997 ( Valery Fine version) on Windows NT
>
> With best regards Voropaev S.G.
This problem is now fixed in the development version 1.03/02.
Result of fitting: p0 = 0.644 +- 0.023, p1 = -1.036 +- 0.256
The fitting algorithm in version 1.02 from TGraph and TGraphErrors objects
assumed errors = 1 !
I have now implemented an algorithm that really uses the error specified
in TGraphErrors and compute an approximation of the errors for TGraph
objects.
Thanks for reporting
Rene Brun
*/
float Xarr[5];
float Yarr[5];
Xarr[0] = 0.062893; Yarr[0] = 0.584000;
Xarr[1] = 0.000000; Yarr[1] = 0.646000;
Xarr[2] = 0.062893; Yarr[2] = 0.572000;
Xarr[3] = 0.125786; Yarr[3] = 0.497000;
Xarr[4] = 0.125786; Yarr[4] = 0.533000;
// Xarr[5] = 0.000000; Yarr[5] = 0.626000;
// Xarr[6] = 0.125786; Yarr[6] = 0.529000;
// Xarr[7] = 0.251572; Yarr[7] = 0.432000;
// Xarr[8] = 0.125786; Yarr[8] = 0.534000;
// Xarr[9] = 0.251572; Yarr[9] = 0.441000;
// Xarr[10] = 0.188679; Yarr[10] = 0.480000;
// Xarr[11] = 0.000000; Yarr[11] = 0.627000;
// Xarr[12] = 0.377358; Yarr[12] = 0.338000;
// Xarr[13] = 0.188679; Yarr[13] = 0.467000;
// Xarr[14] = 0.251572; Yarr[14] = 0.405000;
// Xarr[15] = 0.000000; Yarr[15] = 0.646000;
// Xarr[16] = 0.503145; Yarr[16] = 0.252000;
// Xarr[17] = 0.251572; Yarr[17] = 0.366000;
c1 = new TCanvas("c1","proba");
TF1 *f1 = new TF1("f1","pol1");
f1->SetRange(0,0.15);
TGraph *tg = new TGraph(5, Xarr, Yarr);
tg->Fit("f1","R","AP");
tg->Draw("A*");
}
-------------------------------------------------------------------
Avi Malki
Department of Nuclear Physics
School of Physics and Astronomy
Tel-Aviv University
Israel
University - Phone : 972-3-6405280 Fax : 972-3-6406369
Home - Phone : 972-3-5081734
E-Mail: malki@tauphy.tau.ac.il
WWW : http://www-nuclear.tau.ac.il/~malki/
-------------------------------------------------------------------
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET