File: Binomial.hpp

package info (click to toggle)
consensuscore 1.1.1%2Bdfsg-8
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 3,492 kB
  • sloc: cpp: 38,945; python: 2,083; ansic: 543; sh: 184; makefile: 91; cs: 10
file content (12 lines) | stat: -rw-r--r-- 378 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
// Author: David Alexander

#pragma once

namespace ConsensusCore {
// Returns P[X > q], where X ~ Binom(size, prob);
// i.e. the same value as
//    pbinom(q, size, prob, lower.tail=F)
// in R.   If `asPhred` is true, the probability is converted
// to the "phred" quality scale via Q=-10*log10(p)
double BinomialSurvival(int q, int size, double prob, bool asPhred = false);
}