Skip to content
Snippets Groups Projects
Commit 61b10bab authored by Patrick L.S. Connor's avatar Patrick L.S. Connor
Browse files

first implementation of Ftest

parent 6e475d6c
No related branches found
No related tags found
No related merge requests found
......@@ -235,6 +235,8 @@ int main (int argc, char * argv[])
delete covStat;
delete covSys;
delete cov;
Step::Ftest(cout);
}
fIn.Close();
fOut.Close();
......
......@@ -86,6 +86,8 @@ int main (int argc, char * argv[])
h->Divide(f);
h->SetTitle(f->GetTitle());
h->Write("ratio");
Step::Ftest(cout);
}
fOut->Close();
......
......@@ -86,7 +86,7 @@ int main (int argc, char * argv[])
int N = h->GetNbinsX();
while (std::abs(h->GetBinContent(N)) < deps) { --N; assert(N > 1); }
h->Print("all");
//h->Print("all");
cout << N << endl;
auto f = Step::GetSmoothFit<log,exp>(hExt, cov, 1, N, maxdegree, nsigma, autostop, cout);
cout << "y = " << y << ": " << f->GetTitle() << '\n';
......@@ -130,6 +130,8 @@ int main (int argc, char * argv[])
hExt->SetTitle(f->GetTitle());
h->Write("ratio");
hExt->Write("ratioExt");
Step::Ftest(cout);
}
fOut->Close();
......
......@@ -100,6 +100,8 @@ int main (int argc, char * argv[])
hExt->SetTitle(f->GetTitle());
h->Write("ratio");
hExt->Write("ratioExt");
Step::Ftest(cout);
}
fOut->Close();
......
......@@ -17,6 +17,7 @@
#include <TVectorD.h>
#include <TMatrixD.h>
#include <TDecompSVD.h>
#include <TMath.h>
#include "Math/VectorUtil.h"
#include "Math/Minimizer.h"
......@@ -49,6 +50,29 @@ std::ostream& operator<< (std::ostream& stream, const Result& result) {
}
static std::deque<Result> chi2s;
void Ftest (std::ostream& stream)
{
stream << " \e[1m";
for (auto result = next(begin(Step::chi2s)); result != prev(end(Step::chi2s)); ++result) // loop over all results except the highest one
stream << std::setw(10) << result->X.size();
stream << '\n';
for (auto result2 = next(begin(Step::chi2s)); result2 != end(Step::chi2s); ++result2) { // loop over all results
stream << std::setw(3) << result2->X.size() << "\e[0m";
for (auto result1 = next(begin(Step::chi2s)); result1 != result2; ++result1) { // compare to all results with less parameters
auto RSS1 = result1->chi2,
RSS2 = result2->chi2;
auto p1 = result1->X.size(),
p2 = result2->X.size();
auto ndf = result2->ndf; // = nbins - p2
auto x = ((RSS1-RSS2)/(p2-p1))/(RSS2/(ndf));
auto pvalue = TMath::FDistI(x, p2-p1, ndf);
stream << std::setw(10) << pvalue;
}
stream << "\e[1m\n";
}
stream << "\e[0m";
}
double identity (double x) { return x; }
////////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment