7 #include "../VectorTools.h" 16 const std::vector<size_t>& nrowt,
17 const std::vector<size_t>& ncolt) :
29 throw Exception(
"ContingencyTableGenerator. Input marginals must have size greater than 1.");
32 throw Exception(
"ContingencyTableGenerator. Marginal do not sum to the same value.");
38 for (
size_t i = 1; i <=
ntot_; ++i)
40 x = x + log(static_cast<double>(i));
58 size_t j, l, m, ia, ib, ic, jc, id, ie, ii, nll, nlm, nr_1, nc_1;
59 long double x, y, dummy, sumprb;
68 for (j = 0; j < nc_1; ++j)
75 for (l = 0; l < nr_1; ++l)
81 for (m = 0; m < nc_1; ++m)
91 for (j = m; j < nc_1; ++j)
107 nlm = ia *
static_cast<size_t>((
static_cast<long double>(id) / static_cast<long double>(ie)) + 0.5);
121 j = (
id - nlm) * (ia - nlm);
126 x = x *
static_cast<long double>(j) / (static_cast<long double>(nlm) *
static_cast<long double>(ii + nlm));
135 j = nll * (ii + nll);
140 y = y *
static_cast<long double>(j) / (static_cast<long double>(
id - nll) *
static_cast<long double>(ia - nll));
169 for (m = 0; m < nc_1; ++m)
171 table(nr_1, m) =
jwork_[m];
174 table(nr_1, nc_1) = ib - table(nr_1, nc_1 - 1);
RowMatrix< size_t > rcont2()
std::vector< size_t > ncolt_
Exception base class. Overload exception constructor (to control the exceptions mechanism). Destructor is already virtual (from std::exception)
std::vector< size_t > nrowt_
std::vector< size_t > jwork_
std::vector< double > fact_
ContingencyTableGenerator(const std::vector< size_t > &nrowt, const std::vector< size_t > &ncolt)