/
jobEg3.R
80 lines (55 loc) · 1.19 KB
/
jobEg3.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
rm(list = ls())
#####
## Start with smaller values of n, p, and B to test the code,
## for example, n=200, p=300, B=20
###
n=700 # sample size, 1000
p=2000 # number of predictors, 2000
tol=1e-4; # tolerance
nloop = B = 500
source("0_HDCQR fns.R")
library(survival)
library(quantreg)
library(rqPen)
library(abind)
library(MASS);
library(glmnet);
library(doParallel);
library(foreach);
##############################
######## Simulation Example 3
##############################
jobname = paste0('_eg3_n=',n,'_p=',p)
wdir = getwd()
Sys.setenv(TZ="America/Los_Angeles")
print(c(n,p,nloop))
ncore = detectCores()
print(ncore)
kk = ncore-2
rho=0.3
tU=0.8;
tauL=0.1;
source("1_modelSpec.R")
J;
ntau
TrueBeta[tau.idx,s1]
s1
plot(J, TrueBeta[,s1[1]], type = "l", ylim = c(-5,4))
lines(J, TrueBeta[,s1[2]], lty = 2)
nsim = 500
ns = 0
ORC <- SUMALL <- NULL
DAT <- list()
cl <- makeCluster(kk)
registerDoParallel(cl)
print(getDoParWorkers())
while(ns < nsim){
source("3_Eg3.R")
if (ns %% 10 ==0) {
print(paste(ns, "runs completed!"))
save.image(paste0(wdir,"/Job",jobname,".RData"))
}
}
stopCluster(cl)
stopImplicitCluster()
closeAllConnections()