source: trunk/yat/statistics/LoglikelihoodRatioTestBinomial.h @ 3134

Last change on this file since 3134 was 3134, checked in by Peter, 8 years ago

refs #769 skeleton for new class LoglikelihoodRatioTestBinomial? (not yet functional).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.5 KB
Line 
1#ifndef _theplu_yat_statistics_loglikelihood_ratio_test_binomial
2#define _theplu_yat_statistics_loglikelihood_ratio_test_binomial
3
4// $Id: LoglikelihoodRatioTestBinomial.h 3134 2013-11-27 06:12:16Z peter $
5
6/*
7  Copyright (C) 2013 Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <vector>
26
27namespace theplu {
28namespace yat {
29namespace statistics {
30
31  /**
32     \brief Loglikelihood-ratio test for binomial data
33
34     This class is useful when having binomial data for several
35     populations and especially comparing the frequency in the
36     differen samples.
37  */
38  class LoglikelihoodRatioTestBinomial
39  {
40  public:
41    /**
42       \brief constructor
43       \param n number of populations in data
44     */
45    LoglikelihoodRatioTestBinomial(size_t n=2);
46
47    /**
48       \brief add one data point
49       \param population from which population the data point comes from.
50       \param positive if \c true data point is positive.
51       \param n how many data points added
52     */
53    void add(size_t population, bool positive, long int n=1);
54
55    /**
56       \return Number of data points
57     */
58    unsigned long int n(void) const;
59
60    /**
61       \return Number of data points from population \a i
62     */
63    unsigned long int n(size_t i) const;
64
65    /**
66       \return Number of negative data points
67     */
68    unsigned long int negative(void) const;
69
70    /**
71       \return Number of negative data points from population \a i
72     */
73    unsigned long int negative(size_t i) const;
74
75    /**
76       \return Number of data points
77     */
78    unsigned long int positive(void) const;
79
80    /**
81       \return Number of positive data points from population \a i
82     */
83    unsigned long int positive(size_t i) const;
84
85    /**
86       \return Number of populations
87    */
88    size_t size(void) const;
89
90    /**
91       \brief Calculate natural logarithm of likelihood ratios
92     */
93    double operator()(void) const;
94
95  private:
96    std::vector<unsigned long int> neg_;
97    std::vector<unsigned long int> pos_;
98  };
99
100}}} // of namespace theplu yat statistics
101
102#endif
Note: See TracBrowser for help on using the repository browser.