1
0
mirror of https://github.com/aportelli/LatAnalyze.git synced 2025-07-31 13:57: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

@@ -17,6 +17,7 @@ noinst_PROGRAMS = \
exMathInterpreter \
exMin \
exPlot \
exPValue \
exRand \
exRootFinder
@@ -60,6 +61,10 @@ exPlot_SOURCES = exPlot.cpp
exPlot_CXXFLAGS = $(COM_CXXFLAGS)
exPlot_LDFLAGS = -L../lib/.libs -lLatAnalyze
exPValue_SOURCES = exPValue.cpp
exPValue_CXXFLAGS = $(COM_CXXFLAGS)
exPValue_LDFLAGS = -L../lib/.libs -lLatAnalyze
exRand_SOURCES = exRand.cpp
exRand_CXXFLAGS = $(COM_CXXFLAGS)
exRand_LDFLAGS = -L../lib/.libs -lLatAnalyze

23
examples/exPValue.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <LatAnalyze/Core/Math.hpp>
using namespace std;
using namespace Latan;
int main(int argc, char* argv[])
{
double chi2, ndof;
if (argc != 3)
{
cerr << "usage: " << argv[0] << " <chi^2> <ndof>" << endl;
return EXIT_FAILURE;
}
chi2 = strTo<double>(argv[1]);
ndof = strTo<double>(argv[2]);
cout << "Two-sided p-value: " << Math::chi2PValue(chi2, ndof) << endl;
cout << "chi^2 CCDF : " << Math::chi2Ccdf(chi2, ndof) << endl;
return EXIT_SUCCESS;
}