2 dependent tests, 2 populations, no gold standard
WinBUGS 1.4 code to accompany the paper entitled "Branscum AJ, Gardner IA, Johnson WO. Estimation of diagnostic-test sensitivity and specificity through Bayesian modeling. Prev Vet Med. 2005 May 10;68(2-4):145-63".
Code prepared by Adam Branscum, November 18, 2003 (Updated February 26, 2004)
branscum@ms.uky.edu
Departments of Biostatistics and Statistics
University of Kentucky
Example from section 3.3.1.
Two dependent tests / Two populations.
Estimation of Se and Sp of ELISA and MAT.
Toxoplasmosis in pigs.
Data source: Dubey JP, Thulliez P, Weigel RM, Andrews CD, Lind P, Powell EC. Sensitivity and specificity of various serologic tests for detection of Toxoplasma gondii infection in naturally infected sows. Am J Vet Res. 1995 Aug;56(8):1030-6.
model;
{
y1[1:Q, 1:Q] ~ dmulti(p1[1:Q, 1:Q], n1)
y2[1:Q, 1:Q] ~ dmulti(p2[1:Q, 1:Q], n2)
p1[1,1] <- pi1*eta11 + (1-pi1)*theta11
p1[1,2] <- pi1*eta12 + (1-pi1)*theta12
p1[2,1] <- pi1*eta21 + (1-pi1)*theta21
p1[2,2] <- pi1*eta22 + (1-pi1)*theta22
p2[1,1] <- pi2*eta11 + (1-pi2)*theta11
p2[1,2] <- pi2*eta12 + (1-pi2)*theta12
p2[2,1] <- pi2*eta21 + (1-pi2)*theta21
p2[2,2] <- pi2*eta22 + (1-pi2)*theta22
eta11 <- lambdaD*eta1
eta12 <- eta1 - eta11
eta21 <- gammaD*(1-eta1)
eta22 <- 1 - eta11 - eta12 - eta21
theta11 <- 1 - theta12 - theta21 - theta22
theta12 <- gammaDc*(1-theta1)
theta21 <- theta1 - theta22
theta22 <- lambdaDc* theta1
eta2 <- eta11 + eta21
theta2 <- theta22 + theta12
rhoD <- (eta11 - eta1*eta2) / sqrt(eta1*(1-eta1)*eta2*(1-eta2))
rhoDc <- (theta22 - theta1*theta2) / sqrt(theta1*(1-theta1)*theta2*(1-theta2))
pi1 ~ dbeta(1.3, 5)
pi2 ~ dbeta(1.5, 3)
eta1 ~ dbeta(24.09, 5.73)
theta1 ~ dbeta(23.05, 3.45)
lambdaD ~ dbeta(1.376, 1.161) ## Mode=0.70, 5th %tile=0.10
gammaD ~ dbeta(1.376, 1.161)
lambdaDc ~ dbeta(2, 1.176) ## Mode=0.85, 5th %tile=0.20
gammaDc ~ dbeta(2, 1.176)
}
list(n1=462, n2=537, Q=2, y1=structure(.Data=c(67,25,41,329),.Dim=c(2,2)), y2=structure(.Data=c(97,33,36,371),.Dim=c(2,2)))
list(pi1=0.07, pi2=0.20, eta1=0.83, theta1=0.90, lambdaD=0.50, lambdaDc=0.50, gammaD=0.50, gammaDc=0.50)
node |
mean |
sd |
MC error |
2.50% |
median |
97.50% |
start |
sample |
eta1 |
0.8075 |
0.07051 |
4.541E-4 |
0.6516 |
0.8143 |
0.9246 |
10001 |
100000 |
eta2 |
0.7403 |
0.1159 |
0.00108 |
0.4863 |
0.7498 |
0.9326 |
10001 |
100000 |
theta1 |
0.897 |
0.04269 |
6.067E-4 |
0.809 |
0.9016 |
0.9688 |
10001 |
100000 |
theta2 |
0.8629 |
0.04344 |
6.181E-4 |
0.7756 |
0.867 |
0.9387 |
10001 |
100000 |
rhoD |
0.3121 |
0.2676 |
0.00196 |
-0.1906 |
0.3249 |
0.7918 |
10001 |
100000 |
rhoDc |
0.4015 |
0.1916 |
0.002407 |
-0.004 |
0.4337 |
0.6932 |
10001 |
100000 |
pi1 |
0.1438 |
0.05738 |
7.883E-4 |
0.0269 |
0.1483 |
0.2484 |
10001 |
100000 |
pi2 |
0.1921 |
0.05861 |
7.948E-4 |
0.06753 |
0.1966 |
0.2982 |
10001 |
100000 |