## EXAMPLE 1:
## Sampling is to be carried out to support a claim that a country is free
## of bovine brucellosis. We are not certain of the total number of herds
## in the country and we are not certain of the number of cows within each
## herd.
## The design prevalence for this study is set to 0.01 at the herd level and
## if a herd is positive for brucellosis the individual animal level
## design prevalence is set to 0.10. The sensitivity of the diagnostic
## test to be used is 0.95.
## How many herds and how many animals from within each herd
## need to be sampled to be 95% confident of detecting disease at the
## herd and individual animal level?
rsu.sssep.rs2st(H = NA, N = NA, pstar.c = 0.01, se.c = 0.95,
pstar.u = 0.10, se.u = 0.95, se.p = 0.95)
## A total of 314 herds need to be sampled, 31 cows from each herd.
## EXAMPLE 2:
## Now lets say we know that there are 500 cattle herds in the country and
## we have the results of a recent livestock census providing counts of the
## number of cattle in each herd. How many herds and how many animals from
## within each herd need to be sampled to be 95% confident of detecting
## disease at the herd and individual animal level?
# Generate a vector of herd sizes. The minimum herd size is 25.
set.seed(1234)
hsize <- ceiling(rlnorm(n = 500, meanlog = 1.5, sdlog = 2)) + 25
nsample <- rsu.sssep.rs2st(H = 500, N = hsize, pstar.c = 0.01, se.c = 0.95,
pstar.u = 0.10, se.u = 0.95, se.p = 0.95)
nsample$clusters
head(nsample$units)
## A total of 238 of the 500 herds need to be tested. The number of animals
## to sample from the first herd (comprised of 26 animals) is 18.
Run the code above in your browser using DataLab