# NOT RUN {
#EXAMPLE 1
#We want to simulate data for 10 studies based on an HSROC model assuming
#each study uses the same imperfect reference standard.
# }
# NOT RUN {
N = 10
LAMBDA = 2
sd_alpha = 0.75
THETA = 1.5
sd_theta = 0.5
beta = 0
pi = runif(10,0,1)
REFSTD = list(1, 1:10) #Only 1 reference standard ...
s2 = c(0.5) #Sensitivity of the reference test
c2 = c(0.85) #Specificity of the reference test
sim.data = simdata(N=N, n = c(50,50,60,60,70,70,80,80,90,90),
sub_rs = REFSTD, prev=pi, se_ref=s2, sp_ref=c2, T=THETA,
L=LAMBDA, sd_t=sd_theta, sd_a=sd_alpha, b=beta)
# }
# NOT RUN {
#EXAMPLE 2
#We want to simulate data for 15 studies based on an HSROC model such that
#the first 5 studies share a common reference standard and the remaining
#10 studies also share a common reference standard.
# }
# NOT RUN {
N = 15
LAMBDA = 3.6
sd_alpha = 1.15
THETA = 2.3
sd_theta = 0.75
beta = 0.15
pi = runif(15,0.1,0.5)
REFSTD = list(2, 1:5, 6:15) #Two different reference standards ...
s2 = c(0.40, 0.6) #Sensitivity of the reference tests
c2 = c(0.75,0.95) #Specificity of the reference tests
#Thus, for the first 5 studies, S2 = 0.40 and C2 = 0.75 while for the last
#10 studies s2 = 0.6 and c2 = 0.95
sim.data = simdata(N=N, n=seq(30,120,1), n.random=TRUE, sub_rs = REFSTD,
prev=pi, se_ref=s2, sp_ref=c2, T=THETA, L=LAMBDA, sd_t=sd_theta,
sd_a=sd_alpha, b=beta)
# }
# NOT RUN {
#EXAMPLE 3
#Assume the same context as the one in EXAMPLE 2 and let's suppose
#that each individual cut-off theta_i should lie between [-5,5]
# }
# NOT RUN {
N = 15
LAMBDA = 3.6
sd_alpha = 1.15
THETA = 2.3
sd_theta = 0.75
beta = 0.15
pi = runif(15,0.1,0.5)
REFSTD = list(2, 1:5, 6:15) #Two different reference standards ...
s2 = c(0.40, 0.6) #Sensitivity of the reference tests
c2 = c(0.75,0.95) #Specificity of the reference tests
#Thus, for the first 5 studies, S2 = 0.40 and C2 = 0.75 while for the last
#10 studies s2 = 0.6 and c2 = 0.95
sim.data = simdata(N=N, n=seq(30,120,1), n.random=TRUE, sub_rs = REFSTD,
prev=pi, se_ref=s2, sp_ref=c2, T=THETA, range.T=c(-5,5),L=LAMBDA,
sd_t=sd_theta,sd_a=sd_alpha, b=beta)
# }
Run the code above in your browser using DataLab