For a population of size `nPopulation`

with a given design prevalence
the function computes the probability of finding no testpositives
in a sample of size `nSample`

if an imperfect test is used (given sensitivity
and specificity). This probability corresponds to the alpha-error
(=error of the first kind) of the overall test with null hypothesis:
prevalence = design prevalence. A modified hypergeometric formula
is used; see Cameron, Baldock, 1998.

1 2 | ```
computePValue(nPopulation, nSample, nDiseased,
sensitivity, specificity = 1)
``` |

`nPopulation` |
Integer. Population size. |

`nSample` |
Integer. Size of sample. |

`nDiseased` |
Integer. Number of diseased elements in the population according to the design prevalence. |

`sensitivity` |
Numeric between 0 and 1. Sensitivity (= probability of a testpositive result, given the tested individual is diseased) of the test (e.g., diagnostic test or herd test). |

`specificity` |
Numeric between 0 and 1. Specificity (= probability of a testnegative result, given the tested individual is not diseased) of the test (e.g., diagnostic test or herd test). The default value is 1. |

The return value is a numeric between 0 and 1. It is the probability of finding no testpositives (not diseased!) in the sample.

Ian Kopacka <ian.kopacka@ages.at>

A.R. Cameron and F.C. Baldock, "A new probablility formula to substantiate freedom from disease", Prev. Vet. Med. 34 (1998), pp. 1-17.

`computeOptimalSampleSize`

, `computeAlphaLimitedSampling`

1 2 | ```
alphaError <- computePValue(nPopulation = 3000,
nSample = 1387, nDiseased = 6, sensitivity = 0.85, specificity = 1)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.