bpp-core3  3.0.0
bpp::ContingencyTableTest Class Reference

Implements tests on contingency tables. More...

#include <Bpp/Numeric/Stat/ContingencyTableTest.h>

+ Inheritance diagram for bpp::ContingencyTableTest:
+ Collaboration diagram for bpp::ContingencyTableTest:

Public Member Functions

 ContingencyTableTest (const std::vector< std::vector< size_t >> &table, unsigned int nbPermutations=0, bool warn=true)
 Build a new test object and perform computations. More...
 
virtual ~ContingencyTableTest ()
 
ContingencyTableTestclone () const
 Create a copy of this object and send a pointer to it. More...
 
std::string getName () const
 
double getStatistic () const
 
double getPValue () const
 
double getDegreesOfFreedom () const
 
const std::vector< size_t > getMarginRows () const
 
const std::vector< size_t > getMarginColumns () const
 

Private Attributes

double statistic_
 
double pvalue_
 
double df_
 
std::vector< size_t > margin1_
 
std::vector< size_t > margin2_
 

Detailed Description

Implements tests on contingency tables.

Performs a chi square test on contingency tables.

Definition at line 21 of file ContingencyTableTest.h.

Constructor & Destructor Documentation

◆ ContingencyTableTest()

ContingencyTableTest::ContingencyTableTest ( const std::vector< std::vector< size_t >> &  table,
unsigned int  nbPermutations = 0,
bool  warn = true 
)

Build a new test object and perform computations.

Parameters
tableThe input contingency table.
nbPermutationsIf greater than 0, performs a randomization test instead of using the chisquare approximation.
warnShould a warning message be displayed in case of unsufficient observations?

Definition at line 17 of file ContingencyTableTest.cpp.

References bpp::TextTools::count(), df_, bpp::ApplicationTools::displayWarning(), margin1_, margin2_, bpp::RandomTools::pChisq(), pvalue_, bpp::ContingencyTableGenerator::rcont2(), statistic_, bpp::VectorTools::sum(), and bpp::TextTools::toString().

Referenced by clone().

◆ ~ContingencyTableTest()

virtual bpp::ContingencyTableTest::~ContingencyTableTest ( )
inlinevirtual

Definition at line 40 of file ContingencyTableTest.h.

Member Function Documentation

◆ clone()

ContingencyTableTest* bpp::ContingencyTableTest::clone ( ) const
inlinevirtual

Create a copy of this object and send a pointer to it.

Returns
A pointer toward the copy object.

Implements bpp::Clonable.

Definition at line 42 of file ContingencyTableTest.h.

References ContingencyTableTest().

◆ getDegreesOfFreedom()

double bpp::ContingencyTableTest::getDegreesOfFreedom ( ) const
inline

Definition at line 48 of file ContingencyTableTest.h.

References df_.

◆ getMarginColumns()

const std::vector<size_t> bpp::ContingencyTableTest::getMarginColumns ( ) const
inline

Definition at line 50 of file ContingencyTableTest.h.

References margin2_.

◆ getMarginRows()

const std::vector<size_t> bpp::ContingencyTableTest::getMarginRows ( ) const
inline

Definition at line 49 of file ContingencyTableTest.h.

References margin1_.

◆ getName()

std::string bpp::ContingencyTableTest::getName ( ) const
inlinevirtual

Implements bpp::StatTest.

Definition at line 45 of file ContingencyTableTest.h.

◆ getPValue()

double bpp::ContingencyTableTest::getPValue ( ) const
inlinevirtual

Implements bpp::StatTest.

Definition at line 47 of file ContingencyTableTest.h.

References pvalue_.

◆ getStatistic()

double bpp::ContingencyTableTest::getStatistic ( ) const
inlinevirtual

Implements bpp::StatTest.

Definition at line 46 of file ContingencyTableTest.h.

References statistic_.

Member Data Documentation

◆ df_

double bpp::ContingencyTableTest::df_
private

Definition at line 27 of file ContingencyTableTest.h.

Referenced by ContingencyTableTest(), and getDegreesOfFreedom().

◆ margin1_

std::vector<size_t> bpp::ContingencyTableTest::margin1_
private

Definition at line 28 of file ContingencyTableTest.h.

Referenced by ContingencyTableTest(), and getMarginRows().

◆ margin2_

std::vector<size_t> bpp::ContingencyTableTest::margin2_
private

Definition at line 29 of file ContingencyTableTest.h.

Referenced by ContingencyTableTest(), and getMarginColumns().

◆ pvalue_

double bpp::ContingencyTableTest::pvalue_
private

Definition at line 26 of file ContingencyTableTest.h.

Referenced by ContingencyTableTest(), and getPValue().

◆ statistic_

double bpp::ContingencyTableTest::statistic_
private

Definition at line 25 of file ContingencyTableTest.h.

Referenced by ContingencyTableTest(), and getStatistic().


The documentation for this class was generated from the following files: