mtds = list(
#censored quantile correlation screening
cqcs = function(y, d, x, tau, len = NULL) {
return(cqcs(y, d, x, tau, len))
},
#all observations quantile correlation screening
aocqs = function(y, d, x, tau, len = NULL) {
return(qcs(y, x, tau, len))
},
#completed observation based correlation screening
cocqs = function(y, d, x, tau, len = NULL) {
return(coqcs(y, d, x, tau, len))
}
)
# define parameter sets
ms = 1:200
ns = c(100, 200)
ps = c(100, 200, 500)
heters = c(0, 1)
taus = c(0.25, 0.5, 0.75)
distris = c("normal", "cauchy")
m = 1
n = 100
p = 2000
heter = 0
tau = 0.5
distri = 1
method = 1
foreach = foreach::foreach
datmat_foreach = foreach(m = ms,
.combine = "rbind",
.packages = c("MASS", "cqcs")) %:%
foreach(n = ns, .combine = "rbind") %:%
foreach(p = ps, .combine = "rbind") %:%
foreach(heter = heters, .combine = "rbind") %:%
foreach(tau = taus, .combine = "rbind") %:%
foreach(distri = seq_along(distris), .combine = "rbind") %:%
foreach(method = seq_along(mtds), .combine = "rbind") %dopar% {
## generate datasets
set.seed(m)
dat = cqcs::datagen(
n = n,
p = p,
tau = tau,
distri = distris[distri],
heter = heter
)
y = dat$y
d = dat$d
x = dat$x
##orders
orders = mtds[[method]](y, d, x, tau, p)
len = lngth(orders)
## true positive
orderlogn = orders[1:floor(n / log(n))]
tp = tpn(orderlogn)
## return
rst = list(
m = m,
n = n,
p = p,
heter = heter,
tau = tau,
distri = distris[distri],
method = names(mtds)[method],
rate = dat$rate,
length = len,
tp = tp
)
}
stopImplicitCluster()
write.csv(datmat_foreach, file = "result.csv", row.names = FALSE)