WinBUGS 1.4 code to accompany the paper entitled "Branscum AJ, Gardner IA, Johnson WO. Bayesian modeling of animal- and herd-level prevalences. Prev Vet Med. 2004 Dec 15;66(1-4):101-112".
Code prepared by Adam Branscum, November 18, 2003
branscum@ms.uky.edu
Departments of Biostatistics and Statistics
University of Kentucky
Example from section 2.1.1.
Binomial Sampling: One-test / One-population
Estimate the prevalence of T. gondii in pigs.
Data source: Davies PR, Morrow WE, Deen J, Gamble HR, Patton S. Seroprevalence of Toxoplasma gondii and Trichinella spiralis in finishing swine raised in different production systems in North Carolina, USA. Prev Vet Med. 1998 Jul 17;36(1):67-76.
model
{
Tpos ~ dbin(p, n)
p <- pi*Se + (1-pi)*(1-Sp)
Z ~ dbern(tau0)
Se ~ dbeta(22.5, 10.22) ## Mode=0.70, 95% sure Se > 0.55
Sp ~ dbeta(88.28, 1.882) ## Mode=0.99, 95% sure Sp > 0.95
pistar ~ dbeta(1.80, 26.74) ## Mode=0.03, 95% sure pistar < 0.15
pi <- Z*pistar
piequal0 <- equals(pi,0)
}
list(n=91, Tpos=1, tau0=0.10)
list(pistar=0.03, Se=0.70, Sp=0.99, Z=0)