Learn R Programming

FFD (version 1.0-9)

computePValue: FUNCTION to compute the probability of finding no testpositives in a sample of a certain size.

Description

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.

Usage

computePValue(nPopulation, nSample, nDiseased, 
    sensitivity, specificity = 1)

Value

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

Arguments

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.

Author

Ian Kopacka <ian.kopacka@ages.at>

References

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

See Also

computeOptimalSampleSize, computeAlphaLimitedSampling

Examples

Run this code
alphaError <- computePValue(nPopulation = 3000, 
    nSample = 1387, nDiseased = 6, sensitivity = 0.85, specificity = 1)

Run the code above in your browser using DataLab