3134 |
27 Nov 13 |
peter |
// $Id$ |
3134 |
27 Nov 13 |
peter |
2 |
|
3134 |
27 Nov 13 |
peter |
3 |
/* |
3134 |
27 Nov 13 |
peter |
Copyright (C) 2013 Peter Johansson |
3134 |
27 Nov 13 |
peter |
5 |
|
3134 |
27 Nov 13 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
3134 |
27 Nov 13 |
peter |
7 |
|
3134 |
27 Nov 13 |
peter |
The yat library is free software; you can redistribute it and/or |
3134 |
27 Nov 13 |
peter |
modify it under the terms of the GNU General Public License as |
3134 |
27 Nov 13 |
peter |
published by the Free Software Foundation; either version 3 of the |
3134 |
27 Nov 13 |
peter |
License, or (at your option) any later version. |
3134 |
27 Nov 13 |
peter |
12 |
|
3134 |
27 Nov 13 |
peter |
The yat library is distributed in the hope that it will be useful, |
3134 |
27 Nov 13 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3134 |
27 Nov 13 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3134 |
27 Nov 13 |
peter |
General Public License for more details. |
3134 |
27 Nov 13 |
peter |
17 |
|
3134 |
27 Nov 13 |
peter |
You should have received a copy of the GNU General Public License |
3134 |
27 Nov 13 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
3134 |
27 Nov 13 |
peter |
20 |
*/ |
3134 |
27 Nov 13 |
peter |
21 |
|
3134 |
27 Nov 13 |
peter |
22 |
#include <config.h> |
3134 |
27 Nov 13 |
peter |
23 |
|
3134 |
27 Nov 13 |
peter |
24 |
#include "Suite.h" |
3134 |
27 Nov 13 |
peter |
25 |
|
3138 |
29 Nov 13 |
peter |
26 |
#include "yat/statistics/LikelihoodRatioTestBinomial.h" |
3134 |
27 Nov 13 |
peter |
27 |
|
3134 |
27 Nov 13 |
peter |
28 |
using namespace theplu::yat; |
3134 |
27 Nov 13 |
peter |
29 |
|
3134 |
27 Nov 13 |
peter |
30 |
int main(int argc, char* argv[]) |
3134 |
27 Nov 13 |
peter |
31 |
{ |
3134 |
27 Nov 13 |
peter |
32 |
test::Suite suite(argc, argv); |
3134 |
27 Nov 13 |
peter |
33 |
|
3138 |
29 Nov 13 |
peter |
34 |
statistics::LikelihoodRatioTestBinomial lrt; |
3134 |
27 Nov 13 |
peter |
35 |
|
3134 |
27 Nov 13 |
peter |
36 |
suite.add(lrt.size() == 2); |
3134 |
27 Nov 13 |
peter |
37 |
|
3134 |
27 Nov 13 |
peter |
38 |
lrt.add(0, true, 2); |
3134 |
27 Nov 13 |
peter |
39 |
lrt.add(0, false, 200); |
3134 |
27 Nov 13 |
peter |
40 |
lrt.add(1, false, 5000); |
3134 |
27 Nov 13 |
peter |
41 |
|
3134 |
27 Nov 13 |
peter |
42 |
suite.add(lrt.n() == 5202); |
3134 |
27 Nov 13 |
peter |
43 |
suite.add(lrt.n(0) == 202); |
3134 |
27 Nov 13 |
peter |
44 |
suite.add(lrt.n(1) == 5000); |
3134 |
27 Nov 13 |
peter |
45 |
|
3134 |
27 Nov 13 |
peter |
46 |
suite.add(lrt.positive(0) == 2); |
3134 |
27 Nov 13 |
peter |
47 |
suite.add(lrt.negative(0) == 200); |
3134 |
27 Nov 13 |
peter |
48 |
suite.add(lrt.positive(1) == 0); |
3134 |
27 Nov 13 |
peter |
49 |
suite.add(lrt.negative(1) == 5000); |
3134 |
27 Nov 13 |
peter |
50 |
|
3138 |
29 Nov 13 |
peter |
51 |
double log_lambda = lrt.llr(); |
3134 |
27 Nov 13 |
peter |
52 |
suite.out() << log_lambda << "\n"; |
3134 |
27 Nov 13 |
peter |
53 |
suite.add(log_lambda > 0); |
3134 |
27 Nov 13 |
peter |
54 |
|
3134 |
27 Nov 13 |
peter |
55 |
return suite.return_value(); |
3134 |
27 Nov 13 |
peter |
56 |
} |