bpp-core3  3.0.0
ContingencyTableTest.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_NUMERIC_STAT_CONTINGENCYTABLETEST_H
6 #define BPP_NUMERIC_STAT_CONTINGENCYTABLETEST_H
7 
8 
9 #include "StatTest.h"
10 
11 // From the STL:
12 #include <vector>
13 
14 namespace bpp
15 {
22  public virtual StatTest
23 {
24 private:
25  double statistic_;
26  double pvalue_;
27  double df_;
28  std::vector<size_t> margin1_;
29  std::vector<size_t> margin2_;
30 
31 public:
39  ContingencyTableTest(const std::vector< std::vector<size_t>>& table, unsigned int nbPermutations = 0, bool warn = true);
40  virtual ~ContingencyTableTest() {}
41 
42  ContingencyTableTest* clone() const { return new ContingencyTableTest(*this); }
43 
44 public:
45  std::string getName() const { return "Test on contingency table."; }
46  double getStatistic() const { return statistic_; }
47  double getPValue() const { return pvalue_; }
48  double getDegreesOfFreedom() const { return df_; }
49  const std::vector<size_t> getMarginRows() const { return margin1_; }
50  const std::vector<size_t> getMarginColumns() const { return margin2_; }
51 };
52 } // end of namespace bpp.
53 #endif // BPP_NUMERIC_STAT_CONTINGENCYTABLETEST_H
const std::vector< size_t > getMarginRows() const
Interface for statistical test results.
Definition: StatTest.h:21
const std::vector< size_t > getMarginColumns() const
std::vector< size_t > margin2_
ContingencyTableTest(const std::vector< std::vector< size_t >> &table, unsigned int nbPermutations=0, bool warn=true)
Build a new test object and perform computations.
Implements tests on contingency tables.
ContingencyTableTest * clone() const
Create a copy of this object and send a pointer to it.
std::vector< size_t > margin1_