1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-06-18 15:27:05 +01:00

p-value now 2-sided and added chi^2 CCDF

This commit is contained in:
2019-12-12 18:04:33 +00:00
parent d30303bb54
commit 0ca4e0ef17
8 changed files with 53 additions and 4 deletions

View File

@ -62,6 +62,11 @@ double SampleFitResult::getPValue(const Index s) const
return Math::chi2PValue(getChi2(s), getNDof());
}
double SampleFitResult::getCcdf(const Index s) const
{
return Math::chi2Ccdf(getChi2(s), getNDof());
}
const DoubleFunction & SampleFitResult::getModel(const Index s,
const Index j) const
{
@ -98,8 +103,9 @@ void SampleFitResult::print(const bool printXsi, ostream &out) const
Index pMax = printXsi ? size() : nPar_;
DMat err = this->variance().cwiseSqrt();
sprintf(buf, "chi^2/dof= %.1e/%d= %.2e -- p-value= %.2e", getChi2(),
static_cast<int>(getNDof()), getChi2PerDof(), getPValue());
sprintf(buf, "chi^2/dof= %.1e/%d= %.2e -- chi^2 CCDF= %.2e -- p-value= %.2e",
getChi2(), static_cast<int>(getNDof()), getChi2PerDof(), getCcdf(),
getPValue());
out << buf << endl;
for (Index p = 0; p < pMax; ++p)
{

View File

@ -49,6 +49,7 @@ public:
double getNDof(void) const;
Index getNPar(void) const;
double getPValue(const Index s = central) const;
double getCcdf(const Index s = central) const;
const DoubleFunction & getModel(const Index s = central,
const Index j = 0) const;
const DoubleFunctionSample & getModel(const PlaceHolder ph,

View File

@ -55,6 +55,11 @@ double FitResult::getPValue(void) const
return Math::chi2PValue(getChi2(), getNDof());;
}
double FitResult::getCcdf(void) const
{
return Math::chi2Ccdf(getChi2(), getNDof());;
}
const DoubleFunction & FitResult::getModel(const Index j) const
{
return model_[j];
@ -66,8 +71,9 @@ void FitResult::print(const bool printXsi, ostream &out) const
char buf[256];
Index pMax = printXsi ? size() : nPar_;
sprintf(buf, "chi^2/dof= %.1e/%d= %.2e -- p-value= %.2e", getChi2(),
static_cast<int>(getNDof()), getChi2PerDof(), getPValue());
sprintf(buf, "chi^2/dof= %.1e/%d= %.2e -- chi^2 CCDF= %.2e -- p-value= %.2e",
getChi2(), static_cast<int>(getNDof()), getChi2PerDof(), getCcdf(),
getPValue());
out << buf << endl;
for (Index p = 0; p < pMax; ++p)
{

View File

@ -47,6 +47,7 @@ public:
double getNDof(void) const;
Index getNPar(void) const;
double getPValue(void) const;
double getCcdf(void) const;
const DoubleFunction & getModel(const Index j = 0) const;
// IO
void print(const bool printXsi = false,