bpp-core
2.2.0
|
Generate a random contingency matrix with given marginal counts. More...
#include <Bpp/Numeric/Random/ContingencyTableGenerator.h>
Public Member Functions | |
ContingencyTableGenerator (const std::vector< size_t > &nrowt, const std::vector< size_t > &ncolt) | |
RowMatrix< size_t > | rcont2 (const RandomFactory &generator= *RandomTools::DEFAULT_GENERATOR) |
Private Attributes | |
std::vector< size_t > | nrowt_ |
std::vector< size_t > | ncolt_ |
size_t | nrow_ |
size_t | ncol_ |
size_t | nrowm_ |
size_t | ncolm_ |
std::vector< size_t > | jwork_ |
size_t | ntot_ |
std::vector< double > | fact_ |
Generate a random contingency matrix with given marginal counts.
This procedure was adapted from the original fortran code described in: Patefield, W. M. (1981) Algorithm AS159. An efficient method of generating r x c tables with given row and column totals. Applied Statistics 30, 91-97. This algorithm is the one also used in R function chisq.test for instance.
The code was adpated from file rcont.c, edited by Martin Maechler, Dec 2003, available in the R software source distribution.
nrowt | Marginal counts. |
ncolt | Marginal counts. |
Definition at line 70 of file ContingencyTableGenerator.h.
ContingencyTableGenerator::ContingencyTableGenerator | ( | const std::vector< size_t > & | nrowt, |
const std::vector< size_t > & | ncolt | ||
) |
RowMatrix< size_t > ContingencyTableGenerator::rcont2 | ( | const RandomFactory & | generator = *RandomTools::DEFAULT_GENERATOR | ) |
Definition at line 91 of file ContingencyTableGenerator.cpp.
References bpp::RandomFactory::drawNumber(), fact_, jwork_, ncol_, ncolt_, nrow_, nrowt_, and ntot_.
Referenced by bpp::ContingencyTableTest::ContingencyTableTest().
|
private |
Definition at line 81 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 79 of file ContingencyTableGenerator.h.
Referenced by rcont2().
|
private |
Definition at line 76 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 78 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator().
|
private |
Definition at line 74 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 75 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 77 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator().
|
private |
Definition at line 73 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 80 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().