bpp-core3
3.0.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 () |
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 34 of file ContingencyTableGenerator.h.
ContingencyTableGenerator::ContingencyTableGenerator | ( | const std::vector< size_t > & | nrowt, |
const std::vector< size_t > & | ncolt | ||
) |
RowMatrix< size_t > ContingencyTableGenerator::rcont2 | ( | ) |
Definition at line 55 of file ContingencyTableGenerator.cpp.
References fact_, bpp::RandomTools::giveRandomNumberBetweenZeroAndEntry(), jwork_, ncol_, ncolt_, nrow_, nrowt_, and ntot_.
Referenced by bpp::ContingencyTableTest::ContingencyTableTest().
|
private |
Definition at line 45 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 43 of file ContingencyTableGenerator.h.
Referenced by rcont2().
|
private |
Definition at line 40 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 42 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator().
|
private |
Definition at line 38 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 39 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 41 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator().
|
private |
Definition at line 37 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().
|
private |
Definition at line 44 of file ContingencyTableGenerator.h.
Referenced by ContingencyTableGenerator(), and rcont2().