35 #ifndef MULTOVL_PROB_STAT_HEADER
36 #define MULTOVL_PROB_STAT_HEADER
46 #include "empirdistr.hh"
50 #include "boost/lexical_cast.hpp"
79 unsigned int multiplicity
81 _msg(
"Multiplicity " +
82 boost::lexical_cast<std::string>(multiplicity) +
85 const std::string error_message()
const
104 explicit Distr(
unsigned int ncell = 0):
113 Distr(
double val,
bool is_actual):
127 void add(
double val,
bool is_actual)
129 if (is_actual) _actual = val;
130 else _nulldistr.
add(val);
141 double c = _nulldistr.
cdf(_actual);
142 _pvalue = (c >= 0.5)? 1.0 - c: c;
143 _zscore = (_actual - _nulldistr.
mean())/_nulldistr.
std_dev();
151 bool is_valid()
const {
return _valid; }
152 double actual()
const {
return _actual; }
153 const EmpirDistr& nulldistr()
const {
return _nulldistr; }
154 double p_value()
const {
return _pvalue; }
155 double z_score()
const {
return _zscore; }
169 _minmult(std::numeric_limits<unsigned int>::max()),
180 void add(
unsigned int multiplicity,
182 bool is_actual =
false);
191 const Distr&
distr(
unsigned int multiplicity)
const throw(NotfoundException);
202 typedef std::map<unsigned int, Distr> distrs_t;
203 typedef distrs_t::iterator diter_t;
206 unsigned int _minmult, _maxmult;
212 #endif // MULTOVL_PROB_STAT_HEADER
void add(unsigned int multiplicity, double val, bool is_actual=false)
Stat()
Init to default (empty).
Definition: stat.hh:167
EmpirDistr & add(double x)
void evaluate()
evaluate(): normalise the counts and make the CDF.
Definition: empirdistr.hh:69
const Distr & distr(unsigned int multiplicity) const
unsigned int min_mult() const
Definition: stat.hh:194
void evaluate()
Evaluates the distributions inside.
Definition: empirdistr.hh:58
double cdf(double x) const
unsigned int max_mult() const
Definition: stat.hh:197