n_sim = 1000
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
for(i in 1:n_sim){
est = sim_est(n_trees=n_trees,rec_method=1,seed=i)
RP[i,] = est$real
MP[i,] = est$est
}
print(proc.time()-p)
## user system elapsed
## 1042.764 0.036 1042.787
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.5513 Min. :0.01062 Min. :0.05840
## 1st Qu.:0.7404 1st Qu.:0.01592 1st Qu.:0.08094
## Median :0.8100 Median :0.01745 Median :0.09048
## Mean :0.8104 Mean :0.01768 Mean :0.09241
## 3rd Qu.:0.8839 3rd Qu.:0.02006 3rd Qu.:0.10214
## Max. :1.1230 Max. :0.02548 Max. :0.13243
parallel:
no_cores <- detectCores()- 1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
n_sim = 1000
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
ests <- foreach(i = 1:n_sim, .combine=data.frame,.packages='dmea') %dopar% sim_est(n_trees=n_trees,rec_method=1,seed=i)
print(proc.time()-p)
## user system elapsed
## 3.200 0.052 548.703
for (i in 1:n_sim){
RP[i,] = ests[,(2*i-1)]
MP[i,] = ests[,2*i]
}
stopCluster(cl)
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.3914 Min. :0.001077 Min. :0.04529
## 1st Qu.:0.7212 1st Qu.:0.015341 1st Qu.:0.07859
## Median :0.7977 Median :0.017294 Median :0.08910
## Mean :0.8012 Mean :0.017399 Mean :0.09063
## 3rd Qu.:0.8777 3rd Qu.:0.019685 3rd Qu.:0.10106
## Max. :1.2261 Max. :0.028601 Max. :0.20389
now for sets of 100 trees
no_cores <- detectCores()- 1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
n_sim = 1000
n_trees = 100
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
ests <- foreach(i = 1:n_sim, .combine=data.frame,.packages='dmea') %dopar% sim_est(n_trees=n_trees,rec_method=1,seed=i)
print(proc.time()-p)
## user system elapsed
## 3.192 0.064 4655.357
for (i in 1:n_sim){
RP[i,] = ests[,(2*i-1)]
MP[i,] = ests[,2*i]
}
stopCluster(cl)
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.4334 Min. :0.006796 Min. :0.04571
## 1st Qu.:0.6878 1st Qu.:0.014232 1st Qu.:0.07903
## Median :0.7415 Median :0.015757 Median :0.08937
## Mean :0.7455 Mean :0.015851 Mean :0.09067
## 3rd Qu.:0.8027 3rd Qu.:0.017403 3rd Qu.:0.10044
## Max. :1.0408 Max. :0.026794 Max. :0.20189
n_sim = 400
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
for(i in 1:n_sim){
set.seed(i)
est = sim_est(n_trees=n_trees,rec_method=2)
RP[i,] = est$real
MP[i,] = est$est
}
print(proc.time()-p)
## user system elapsed
## 349.648 0.012 349.657
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.4223 Min. :0.007863 Min. :0.04317
## 1st Qu.:0.5681 1st Qu.:0.012041 1st Qu.:0.06227
## Median :0.6305 Median :0.014087 Median :0.06893
## Mean :0.6373 Mean :0.014127 Mean :0.07075
## 3rd Qu.:0.7038 3rd Qu.:0.016171 3rd Qu.:0.07928
## Max. :0.8744 Max. :0.021294 Max. :0.10934
n_sim = 400
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
for(i in 1:n_sim){
set.seed(i)
est = sim_est(n_trees=n_trees,rec_method=3)
RP[i,] = est$real
MP[i,] = est$est
}
print(proc.time()-p)
## user system elapsed
## 441.744 0.004 441.756
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.6482 Min. :0.01208 Min. :0.0597
## 1st Qu.:0.8443 1st Qu.:0.01710 1st Qu.:0.0883
## Median :0.9385 Median :0.01953 Median :0.1044
## Mean :0.9271 Mean :0.01925 Mean :0.1107
## 3rd Qu.:1.0162 3rd Qu.:0.02148 3rd Qu.:0.1239
## Max. :1.2272 Max. :0.02828 Max. :0.2443
n_sim = 400
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
for(i in 1:n_sim){
set.seed(i)
est = sim_est(n_trees=n_trees,rec_method=1,impsam = TRUE)
RP[i,] = est$real
MP[i,] = est$est
}
print(proc.time()-p)
## user system elapsed
## 452.640 0.016 452.640
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
par_est_vis(P=MP[MP[,1]<3,],par=1,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=2,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=3,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(MP[MP[,1]<3,])
## V1 V2 V3
## Min. :0.5286 Min. :0.009621 Min. :0.05154
## 1st Qu.:0.7170 1st Qu.:0.015801 1st Qu.:0.08362
## Median :0.8157 Median :0.017745 Median :0.09922
## Mean :0.8236 Mean :0.018244 Mean :0.09829
## 3rd Qu.:0.9394 3rd Qu.:0.021159 3rd Qu.:0.11354
## Max. :1.1438 Max. :0.025995 Max. :0.13838
more simulations (but in parallel)
no_cores <- detectCores()- 1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
n_sim = 1000
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
ests <- foreach(i = 1:n_sim, .combine=data.frame,.packages='dmea') %dopar% sim_est(n_trees=n_trees,rec_method=1,seed=i,impsam=TRUE)
print(proc.time()-p)
## user system elapsed
## 3.148 0.068 627.128
for (i in 1:n_sim){
RP[i,] = ests[,(2*i-1)]
MP[i,] = ests[,2*i]
}
stopCluster(cl)
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.2018 Min. :0.001382 Min. :0.03459
## 1st Qu.:0.8035 1st Qu.:0.017836 1st Qu.:0.08098
## Median :7.2641 Median :0.162620 Median :0.09363
## Mean :4.5055 Mean :0.102828 Mean :0.09742
## 3rd Qu.:7.8073 3rd Qu.:0.181441 3rd Qu.:0.10792
## Max. :8.4758 Max. :0.220035 Max. :0.90000
par_est_vis(P=MP[MP[,1]<3,],par=1,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=2,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=3,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(MP[MP[,1]<3,])
## V1 V2 V3
## Min. :0.2018 Min. :0.001382 Min. :0.04629
## 1st Qu.:0.6854 1st Qu.:0.014861 1st Qu.:0.08114
## Median :0.7912 Median :0.017412 Median :0.09596
## Mean :0.8224 Mean :0.018214 Mean :0.09795
## 3rd Qu.:0.9127 3rd Qu.:0.020835 3rd Qu.:0.10845
## Max. :2.3456 Max. :0.054548 Max. :0.33684
more trees?
no_cores <- detectCores()- 1
cl <- makeCluster(no_cores)
registerDoParallel(cl)
n_sim = 1000
n_trees = 100
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
ests <- foreach(i = 1:n_sim, .combine=data.frame,.packages='dmea') %dopar% sim_est(n_trees=n_trees,rec_method=1,seed=i,impsam=TRUE)
print(proc.time()-p)
## user system elapsed
## 3.156 0.052 5568.794
for (i in 1:n_sim){
RP[i,] = ests[,(2*i-1)]
MP[i,] = ests[,2*i]
}
stopCluster(cl)
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
summary(MP)
## V1 V2 V3
## Min. :0.1637 Min. :0.001181 Min. :0.03663
## 1st Qu.:0.7732 1st Qu.:0.016936 1st Qu.:0.08429
## Median :7.3786 Median :0.166026 Median :0.09725
## Mean :4.6036 Mean :0.103993 Mean :0.10487
## 3rd Qu.:7.6891 3rd Qu.:0.171154 3rd Qu.:0.11129
## Max. :8.4726 Max. :0.201329 Max. :0.90000
par_est_vis(P=MP[MP[,1]<3,],par=1,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=2,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=3,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(MP[MP[,1]<3,])
## V1 V2 V3
## Min. :0.1637 Min. :0.001181 Min. :0.03663
## 1st Qu.:0.6672 1st Qu.:0.014437 1st Qu.:0.08777
## Median :0.7538 Median :0.016513 Median :0.09980
## Mean :0.7821 Mean :0.017165 Mean :0.10116
## 3rd Qu.:0.8361 3rd Qu.:0.018816 3rd Qu.:0.11128
## Max. :2.3755 Max. :0.055244 Max. :0.19698
n_sim = 400
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
for(i in 1:n_sim){
set.seed(i)
est = sim_est(n_trees=n_trees,rec_method=2,impsam = TRUE)
RP[i,] = est$real
MP[i,] = est$est
}
print(proc.time()-p)
## user system elapsed
## 411.296 0.004 411.300
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
par_est_vis(P=MP[MP[,1]<3,],par=1,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=2,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=3,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(MP[MP[,1]<3,])
## V1 V2 V3
## Min. :0.1702 Min. :0.001396 Min. :0.03851
## 1st Qu.:0.6104 1st Qu.:0.013530 1st Qu.:0.06719
## Median :0.7025 Median :0.015800 Median :0.07976
## Mean :0.7241 Mean :0.016412 Mean :0.08156
## 3rd Qu.:0.8011 3rd Qu.:0.018751 3rd Qu.:0.09436
## Max. :1.8241 Max. :0.040536 Max. :0.14565
n_sim = 400
n_trees = 10
MP = matrix(nrow=n_sim,ncol=3)
RP = matrix(nrow=n_sim,ncol=3)
p = proc.time()
for(i in 1:n_sim){
set.seed(i)
est = sim_est(n_trees=n_trees,rec_method=3,impsam = TRUE)
RP[i,] = est$real
MP[i,] = est$est
}
print(proc.time()-p)
## user system elapsed
## 395.760 0.008 395.762
par_est_vis(P=MP,par=1,PR=RP)
par_est_vis(P=MP,par=2,PR=RP)
par_est_vis(P=MP,par=3,PR=RP)
par_est_vis(P=MP[MP[,1]<3,],par=1,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=2,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
par_est_vis(P=MP[MP[,1]<3,],par=3,PR=RP[MP[,1]<3,])
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
summary(MP[MP[,1]<3,])
## V1 V2 V3
## Min. :0.5114 Min. :0.00997 Min. :0.04844
## 1st Qu.:0.8082 1st Qu.:0.01699 1st Qu.:0.07569
## Median :0.9167 Median :0.01969 Median :0.08794
## Mean :0.9298 Mean :0.02000 Mean :0.09392
## 3rd Qu.:1.0341 3rd Qu.:0.02236 3rd Qu.:0.10527
## Max. :1.5865 Max. :0.03821 Max. :0.23297