mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
method to get fit p-value from fit interface
This commit is contained in:
parent
25698fc6b2
commit
e950e18639
@ -39,8 +39,9 @@ int main(void)
|
||||
data.fitAllPoints();
|
||||
p = data.fit(minimizer, init, f);
|
||||
|
||||
cout << "a= " << p(0) << " b= " << p(1)
|
||||
<< " chi^2/ndof= " << p.getChi2PerDof() << endl;
|
||||
cout << "a= " << p(0) << " b= " << p(1);
|
||||
cout << " chi^2/ndof= " << p.getChi2PerDof();
|
||||
cout << " p-value= " << p.getPValue() <<endl;
|
||||
|
||||
// plot result
|
||||
Plot plot;
|
||||
|
@ -18,10 +18,12 @@
|
||||
*/
|
||||
|
||||
#include <LatAnalyze/XYSampleData.hpp>
|
||||
#include <LatAnalyze/Math.hpp>
|
||||
#include <LatAnalyze/includes.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace Latan;
|
||||
using namespace Math;
|
||||
|
||||
/******************************************************************************
|
||||
* SampleFitResult implementation *
|
||||
@ -51,6 +53,11 @@ double SampleFitResult::getNDof(void) const
|
||||
return static_cast<double>(nDof_);
|
||||
}
|
||||
|
||||
double SampleFitResult::getPValue(const Index s) const
|
||||
{
|
||||
return chi2PValue(getChi2(s), getNDof());
|
||||
}
|
||||
|
||||
const DoubleFunction & SampleFitResult::getModel(const Index s,
|
||||
const Index j) const
|
||||
{
|
||||
|
@ -47,6 +47,7 @@ public:
|
||||
double getChi2PerDof(const Index s = central) const;
|
||||
DSample getChi2PerDof(const PlaceHolder ph) const;
|
||||
double getNDof(void) const;
|
||||
double getPValue(const Index s = central) const;
|
||||
const DoubleFunction & getModel(const Index s = central,
|
||||
const Index j = 0) const;
|
||||
const DoubleFunctionSample & getModel(const PlaceHolder ph,
|
||||
|
@ -19,9 +19,11 @@
|
||||
|
||||
#include <LatAnalyze/XYStatData.hpp>
|
||||
#include <LatAnalyze/includes.hpp>
|
||||
#include <LatAnalyze/Math.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace Latan;
|
||||
using namespace Math;
|
||||
|
||||
/******************************************************************************
|
||||
* FitResult implementation *
|
||||
@ -42,6 +44,11 @@ double FitResult::getNDof(void) const
|
||||
return static_cast<double>(nDof_);
|
||||
}
|
||||
|
||||
double FitResult::getPValue(void) const
|
||||
{
|
||||
return chi2PValue(getChi2(), getNDof());;
|
||||
}
|
||||
|
||||
const DoubleFunction & FitResult::getModel(const Index j) const
|
||||
{
|
||||
return model_[static_cast<unsigned int>(j)];
|
||||
|
@ -48,6 +48,7 @@ public:
|
||||
double getChi2(void) const;
|
||||
double getChi2PerDof(void) const;
|
||||
double getNDof(void) const;
|
||||
double getPValue(void) const;
|
||||
const DoubleFunction & getModel(const Index j = 0) const;
|
||||
private:
|
||||
double chi2_{0.0};
|
||||
|
Loading…
Reference in New Issue
Block a user