Simulation example: adaptive selection

In this vignette, we will illustrate the use of this package by reproducing the simulation studies in Yang et al., (2022), Section 4. The following codes layout the simulation setups.

library(ElasticIntegrative)
m <- 2000 # size for RWE
niter <- 2000 # number of replication
thres.psi  <-  sqrt(log(m)) # threshold for ACI psi
alltlocalpar <- c(2,1,round((seq(0.8,0,length.out=8)),2))

Now, we generate the necessary datasets by GenData and conduct the proposed method by elasticHTE for elastic integrative analyses.

# psi = c(0, 0, 0)
elastic_psi000_lists <- lapply(alltlocalpar, function(tlocalpar)
  {
  elastic_list <- sapply(1:niter, function(seed)
  {
    Data.list <- GenData(beta0 = c(0, 1, 1, 1), # for the mu0 function
                         psi0 = c(0, 0, 0), # for the contrast function
                         n = 1e5, mean.x = 1,  # setup for the finite population
                         n.t = NULL, # for the RCT, use the default sample size
                         m = m, tlocalpar = tlocalpar, # for the RWE
                         seed = seed)
    elasticHTE(Data.list$RT, # RCT
               Data.list$RW, # RWE
               thres.psi = thres.psi,
               fixed = FALSE # adaptive selection strategy
               )
  })
  class(elastic_list) <- 'res' # overload
  elastic_list
})
# psi = c(0, 1, 1)
elastic_psi011_lists <- lapply(alltlocalpar, function(tlocalpar)
  {
  elastic_list <- sapply(1:niter, function(seed)
  {
    Data.list <- GenData(beta0 = c(0, 1, 1, 1), # for the mu0 function
                         psi0 = c(0, 1, 1), # for the contrast function
                         n = 1e5, mean.x = 1,  # setup for the finite population
                         n.t = NULL, # for the RCT, use the default sample size
                         m = m, tlocalpar = tlocalpar, # for the RWE
                         seed = seed)
    elasticHTE(Data.list$RT, # RCT
               Data.list$RW, # RWE
               thres.psi = thres.psi,
               fixed = FALSE # adaptive selection strategy
               )
  })
  class(elastic_list) <- 'res'
  elastic_list
})

At last, we reproduce the summary results in Yang et al., (2022), Table 1 and the plots in Yang et al., (2022), Figure 4 as follow.

Simulation results for coverage rates (%) with nonzero effect modification \(\psi_1=\psi_2=0\)
RT.2 RT.3 EE.2 EE.3 ELAS.2 ELAS.3
0 94.1 94.1 93.8 93.7 92.7 92.4
0.11 94.1 94.1 92.2 92.7 93.2 92.8
0.23 94.1 94.0 88.5 89.8 92.8 92.8
0.34 94.1 94.0 83.2 84.4 94.0 93.8
0.46 94.1 94.0 74.7 76.3 94.5 94.6
0.57 94.1 94.0 66.4 66.1 95.6 95.2
0.69 94.1 94.1 56.1 56.3 95.6 95.8
0.8 94.1 94.0 46.3 46.8 95.4 95.6
1 94.1 94.0 31.5 31.0 95.4 95.0
2 94.1 94.0 2.9 3.6 94.3 94.4
Simulation results for widths of 95% confidence intervals (\(\times 10^{-3}\)) with nonzero effect modification \(\psi_1=\psi_2=0\)
RT.2 RT.3 EE.2 EE.3 ELAS.2 ELAS.3
0 528 528 243 242 472 473
0.11 527 528 242 242 488 487
0.23 527 528 241 242 496 497
0.34 528 528 241 241 516 516
0.46 528 528 239 240 530 530
0.57 528 528 238 238 535 535
0.69 528 528 235 236 534 534
0.8 528 528 233 234 532 532
1 528 528 229 230 529 529
2 528 528 207 208 527 527
Simulation results for coverage rates (%) with nonzero effect modification \(\psi_1=\psi_2=1\)
RT.2 RT.3 EE.2 EE.3 ELAS.2 ELAS.3
0 94.3 93.8 95.0 94.2 92.7 92.5
0.11 94.3 93.8 93.3 92.9 92.9 92.7
0.23 94.3 93.8 89.8 89.0 93.3 92.7
0.34 94.3 93.8 84.9 83.4 94.4 93.4
0.46 94.3 93.8 76.8 75.8 94.4 94.4
0.57 94.3 93.8 67.2 66.8 95.6 94.8
0.69 94.3 93.8 56.8 55.9 95.3 94.6
0.8 94.3 93.8 46.5 45.2 95.3 95.0
1 94.3 93.8 31.0 29.4 95.4 94.9
2 94.3 93.8 2.6 3.0 94.7 94.2
Simulation results for widths of 95% confidence intervals (\(\times 10^{-3}\)) with nonzero effect modification \(\psi_1=\psi_2=1\)
RT.2 RT.3 EE.2 EE.3 ELAS.2 ELAS.3
0 529 530 243 243 472 474
0.11 529 530 242 243 479 480
0.23 529 530 241 242 498 500
0.34 529 530 241 242 511 514
0.46 529 530 240 240 524 526
0.57 529 530 238 239 530 532
0.69 529 530 236 236 529 531
0.8 529 530 233 234 530 532
1 529 530 229 230 530 532
2 529 530 208 209 528 530