#Folder where functions are located - needs to be changed corresponding to computer setwd("C:\\Rprograms") #Program that contains R functions used to find ORC and CRC source("functions.R") ################################################################################ # Section 3 - Find ORC and CRC for p = 0.05, alpha = 0.1, I = 5 # See Table 2 in the on-line supplementary materials for the same numerical values # Sensitivity and specificity Se <- 0.95 Sp <- 0.95 #Order statistics for individual probabilities p.a0.1 <- beta.dist(p = 0.05, a = 0.1, grp.sz = 5) p.a0.1 #CRC CRC.a0.1 <- get.CRC(p = p.a0.1, se = Se, sp = Sp, stages = 3) CRC.a0.1$ET # E(T) CRC.a0.1$ET/5 # E(T)/I CRC.a0.1$I2 # Subgroup sizes for second stage #ORC ORC.a0.1 <- get.CRC(p = p.a0.1, se = Se, sp = Sp, everycase = TRUE, stages = 3) ORC.a0.1$ET # E(T) ORC.a0.1$ET/5 # E(T)/I ORC.a0.1$I2 # Subgroup sizes for second stage ################################################################################ # Section 4 - Los Angeles # See Table 1 of paper for the same numerical values # Sensitivity and specificity Se <- 0.99 Sp <- 0.99 # From Sherlock et al. (2007) overall.p <- 4.47/1000 init.gpsz <- 90 p1 <- rep(x = overall.p, times = init.gpsz) # Homogeneous case # Because the initial group size is so large, we use simulation to estimate # the order statistics for the individual probabilities set.seed(7128) p2 <- beta.dist(p = overall.p, a = 1, grp.sz = init.gpsz, simul = TRUE) p3 <- beta.dist(p = overall.p, a = 0.5, grp.sz = init.gpsz, simul = TRUE) p4 <- beta.dist(p = overall.p, a = 0.1, grp.sz = init.gpsz, simul = TRUE) #ORC under homogeniety - The ORC is the same as the CRC here, so we just # include code for the CRC here. Note that it takes a few days to compute # the ORC. case1 <- get.CRC(p = p1, se = Se, sp = Sp, stages = 3) case1$ET # E(T) case1$I2 # Subgroup sizes for second stage case2 <- get.CRC(p = p2, se = Se, sp = Sp, stages = 3) case2$ET (case1$ET-case2$ET)/case1$ET # Proportion reduction in E(T) by CRC case2$I2 case3 <- get.CRC(p = p3, se = Se, sp = Sp, stages = 3) case3$ET (case1$ET-case3$ET)/case1$ET case3$I2 case4 <- get.CRC(p = p4, se = Se, sp = Sp, stages = 3) case4$ET (case1$ET-case4$ET)/case1$ET case4$I2 #