Please read tips for efficient and successful posting and posting code
ROOT Version: 5.34
Platform: Ubuntu Virtual Machine on Windows10 host
Compiler: CINT/ROOT C/C++ Interpreter version 5.18.00
Hello, I’m trying to implement an F-test to compare two fit models, but my function seems diverging somewhere when the degrees of freedom of my models get too high.
void Ftest(){
Int_t ndf1=105;
Int_t ndf2= 102;
TF1 *pdf= new TF1("pdf","TMath::Gamma(([0]+[1])/2)/(x*TMath::Gamma([0]/2)*TMath::Gamma([1]/2))*TMath::Power([0]*x,[0]/2)*TMath::Power([1],[1]/2)/(TMath::Power([0]*x+[1],([0]+[1])/2))",0,5);
pdf->SetParameters(ndf1,ndf2);
pdf->SetTitle("F distribution");
TCanvas *distr= new TCanvas("distr","F test",1000,800);
pdf->Draw();
Double_t probabilita = pdf->Integral(1,5);
printf("Probability:%f\n", probabilita);
}
When the two ndf1 and ndf2 are low, the function has the expected shape for a Fisher distribution. When the degrees of freedom are around 100, it has the shape in the figure, but you can see it goes way too high in amplitude and therefore, goes to infinity for higher values (my ndfs should be around 300).
Is there some problem with the definition of the function?
Ftest.C (475 Bytes)