File: Binomial.hpp

package info (click to toggle)
consensuscore 1.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,404 kB
  • sloc: cpp: 38,940; python: 2,083; ansic: 542; sh: 184; makefile: 82; cs: 10
file content (12 lines) | stat: -rw-r--r-- 378 bytes parent folder | download | duplicates (4)
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);
}