# NOT RUN {
#===============================================================
#TO SET UP THE REFERENCE STANDARD
#===============================================================
#There were three different reference standards for the In.house dataset.
#The first reference standard was used in study 1 and 2,
#the second was used in studies 3 and 4 and the third in study 5 to 12.
REFSTD = list(3, 1:2, 3:4, 5:11)
#===============================================================
#TO SET UP DATA AND INITIAL VALUES
#===============================================================
data(In.house)
M = length(In.house[,1])
#Initial values for the within-study parameters
init.alpha = rep(2.5, M) ; init.theta = rep(1, M) ;
init.s1 = rep(0.5, M) ; init.c1 = rep(0.5, M) ;
init.pi = rep(0.5, M)
#Initial values for the between-study parameters
init.THETA = 1 ; init.sd.theta = 0.5 ;
init.LAMBDA = 2.5 ; init.sd.alpha = 0.5 ;
init.beta = 0 ;
#Initial values for the reference standard sensitivities and specificities
init.s2 = rep(0.5, REFSTD[[1]]) ; init.c2 = rep(0.5, REFSTD[[1]])
#The ordering of the initial values is important!
init1 = cbind(init.alpha, init.theta, init.s1, init.c1, init.pi)
init2 = c(init.THETA, init.sd.theta, init.LAMBDA, init.sd.alpha, init.beta)
init3 = rbind(init.s2, init.c2)
init = list(init1, init2, init3)
#===============================================================
#TO PROVIDE PRIOR INFORMATION
#===============================================================
S2.a = c(0.2, 0.2, 0.7) ; S2.b = c(0.6, 0.7, 0.9)
C2.a = rep(0.9, 3) ; C2.b = rep(1, 3)
#===============================================================
#TO RUN GIBBS SAMPLER
#===============================================================
# }
# NOT RUN {
set.seed(10)
HSROC(data=In.house, init=init, iter.num=50000,
prior.SEref=c(S2.a,S2.b), prior.SPref=c (C2.a,C2.b), sub_rs=REFSTD)
#Putting prior information on sigma_alpha^2 (sigma_alphs squared)
#instead of sigma_alpha
set.seed(10)
HSROC(data=In.house, init=init, iter.num=50000,
prior.SEref=c(S2.a,S2.b), prior.SPref=c (C2.a,C2.b),
sub_rs=REFSTD, prior_sd_alpha = list(0,2,"v"))
#Letting the function select randomly its own initial values
set.seed(10)
HSROC(data=In.house, iter.num=50000,
prior.SEref=c(S2.a,S2.b), prior.SPref=c (C2.a,C2.b),
sub_rs=REFSTD)
#For more help on this function, see the tutorial pdf file availalbe
#at http://www.nandinidendukuri.com/filesonjoomlasite/HSROC_R_Tutorial.pdf
# }
Run the code above in your browser using DataLab