Learn R Programming

hiPOD (version 1.0)

probDetEqual3: Probability of Detection

Description

Find the probability of detection.

Usage

probDetEqual3(MAF, Xmean, T, N.p, error)

Arguments

MAF

Xmean

T
The threshold, usually calculated from diffVariantError()
N.p

error

Examples

Run this code
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(MAF, Xmean, T, N.p, error)
{
	pDetEqual <- 0;
	for(n in 0:(2*N.p))
	{
		pConf <- dbinom(n,2*N.p,MAF);
		pDet.not <- 0;
		theta <- (1-error)*n/(2*N.p) + error*(1-n/(2*N.p))
		
		pDet <- pbinom(T-1, Xmean, theta, lower.tail=FALSE)

		pDetEqual <- pDetEqual + pConf*pDet;
	}	
	pDetEqual
  }

Run the code above in your browser using DataLab