Skip to main content
. 2011 May 5;1(1):1–35. doi: 10.3390/diagnostics1010001
model;
# Calculates posterior distribution of model parameters and the area under curve. y = test
# Based on O'Mally et al. [6] regression method.
{
# likelihood function
  for(i in 1:N) {
# The following statement is the regression of y on the disease vector d
   y[i]∼dnorm(mu[i],precy[d[i]+1]);
#   yt[i] < −log(y[i]); # logarithmic transformation
# The beta vector are the regression coefficients
   mu[i] < −beta[1] + beta[2] × d[i];
    }
# prior distributions - non-informative prior; similarly for informative priors
  for(i in 1:P) {
   beta[i] ∼ dnorm(0, 0.000001);
    }
  for(i in 1:K) {
   precy[i]∼dgamma(0.001, 0.001);
   vary[i] < −1.0/precy[i];
    }
# calculates area under the curve
  la1 < −beta[2]/sqrt(vary[1]); # ROC curve parameters
  la2 < −vary[2]/vary[1];
# auc is the area under the ROC curve
  auc < −phi(la1/sqrt(1+la2));
}
# Diabetes data
list(K = 2, P = 2, N = 78, y = c(123,129,115,131,119,111,129,127,118,111, 131,118,126,130,122,112,122,128,123,119,132,118,126,136,118,122, 119,117,129,120,125,115,131,123,130,113,128,138,119,118,124,127, 139,120,122,120,114,114,122,127,123,118,131,130,139,125,135,121,124, 109,106,100,88,106,108,110,111,112,94,122,110,113,106,114,101,99,128,106), d = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))
# the initial values for the simulation
list(beta = c(0,0),precy = c(1,1))