## EXAMPLE 1:
## You would like to confirm the absence of disease in a single 1000-cow
## dairy herd. You expect the prevalence of disease in the herd to be 0.05.
## You intend to use a single test with a sensitivity of 0.90 and a
## specificity of 1.00. How many herds need to be sampled if you want to
## be 95% certain that the prevalence of brucellosis in dairy herds is
## less than the design prevalence if all tests are negative?
rsu.sssep.rs(N = 1000, pstar = 0.05, se.p = 0.95, se.u = 0.90)
## We need to sample 65 cows.
## EXAMPLE 2:
## You would like to confirm the absence of disease in a study area comprised
## of 5000 herds. If the disease is present you expect the between-herd
## prevalence to be 0.08. You intend to use two tests: the first has a
## sensitivity and specificity of 0.90 and 0.80, respectively. The second has
## a sensitivity and specificity of 0.95 and 0.85, respectively. The two tests
## will be interpreted in parallel. Assuming the two tests are independent,
## how many herds should be sampled to be 95% certain that the disease
## would be detected if it is present in the study area?
## Calculate the sensitivity and specificity of the diagnostic test regime:
test <- rsu.dxtest(se = c(0.90, 0.95), sp = c(0.80, 0.85),
covar.pos = 0, covar.neg = 0, interpretation = "parallel")
## Interpretation of these tests in parallel returns a diagnostic sensitivity
## of 0.995 and a diagnostic specificity of 0.68.
## How many herds should be sampled?
rsu.sssep.rs(N = 5000, pstar = 0.08, se.p = 0.95, se.u = test$se)
## If you test 38 herds and all return a negative test you can state that
## you are 95% confident that the disease is absent from the study area.
## The sensitivity of this testing regime is 99%.
## EXAMPLE 3:
## You want to document the absence of Mycoplasma from a 200-sow pig herd.
## Based on your experience and the literature, a minimum of 20% of sows
## would have seroconverted if Mycoplasma were present in the herd. How
## many herds should we sample to be 95% certain that Mycoplasma would
## be detected if it is present if you use a test with perfect sensitivity?
rsu.sssep.rs(N = 200, pstar = 0.20, se.p = 0.95, se.u = 1.00)
## If you test 15 sows and all of them test negative you can be 95%
## confident that the prevalence rate of Mycoplasma in the herd is less than
## 20%.
Run the code above in your browser using DataLab