bpp-core  2.1.0
 All Classes Namespaces Files Functions Variables Typedefs Friends
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 56 of file ContingencyTableTest.h.

Constructor & Destructor Documentation

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 53 of file ContingencyTableTest.cpp.

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

Referenced by clone().

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

Definition at line 75 of file ContingencyTableTest.h.

Member Function Documentation

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 82 of file ContingencyTableTest.h.

References ContingencyTableTest().

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

Definition at line 88 of file ContingencyTableTest.h.

References df_.

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

Definition at line 90 of file ContingencyTableTest.h.

References margin2_.

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

Definition at line 89 of file ContingencyTableTest.h.

References margin1_.

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

Implements bpp::StatTest.

Definition at line 85 of file ContingencyTableTest.h.

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

Implements bpp::StatTest.

Definition at line 87 of file ContingencyTableTest.h.

References pvalue_.

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

Implements bpp::StatTest.

Definition at line 86 of file ContingencyTableTest.h.

References statistic_.

Member Data Documentation

double bpp::ContingencyTableTest::df_
private
std::vector<size_t> bpp::ContingencyTableTest::margin1_
private
std::vector<size_t> bpp::ContingencyTableTest::margin2_
private
double bpp::ContingencyTableTest::pvalue_
private

Definition at line 61 of file ContingencyTableTest.h.

Referenced by ContingencyTableTest(), ContingencyTableTest(), and getPValue().

double bpp::ContingencyTableTest::statistic_
private

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