MarcinKosinski/Simulations

Results

Closed this issue · 1 comments

No 1

Simulations code

m1 <- vector("list", 100)
library(parallel)
cl <- makeCluster(detectCores())
clusterEvalQ(cl, library(Rpickands))
system.time({
  m1 <- parLapply(cl, 1:100,Take_expected_value, copy_number=100000,points=10000)
})
stopCluster(cl)

user system elapsed

0.22 0.91 2741.93

plot(unlist(m1)/1:100, ylim=c(0,3))
abline(h=1/(sqrt(pi)), col="red")
unlist(m1)

Results:

[1]  2.696103  3.824087  4.757944  5.782585  6.103098  8.314943  7.933611  8.586543  9.239043 11.644069 10.191150 12.010007
[13] 16.825036 14.475594 13.182947 14.777401 10.451305 23.840736 14.237660  9.955883 17.517705 19.271054 14.542429 12.563869
[25] 11.377340 10.100034 19.189640 12.080305 14.395206 22.932530 11.070851 75.039759 10.139179 28.693873 10.352961 14.428169
[37] 10.980427 13.175679 18.998276 10.090254 10.091116 13.606485 12.646165 12.196682 15.277995 10.864889 10.761174 12.558026
[49] 11.161201 21.001675  9.187723 20.033081  8.636519 26.310541 67.970616 10.430356 10.746864 14.495912 19.766499 12.845559
[61] 11.045934 11.820578 10.737559 11.564290 13.168917 10.964343 16.186598 17.438162 13.712377 24.905167 22.606472  9.789053
[73] 16.089995 11.796208 23.471996 10.010266 12.803666 10.331008 19.545839 14.429806 80.925815 10.553487 20.343777 19.146669
[85] 14.432933 10.713293  9.557530  9.406336 12.601006 10.623573 59.562875 10.918457 14.719750 14.125113 10.156976 10.098214
[97] 10.500530 10.508240 14.317996 14.265341

Plot of results -> unlist(m1)/1:100

rplot01

No 2

HUGE SIMULATION

m1 <- vector("list", 100)
library(parallel)
cl <- makeCluster(detectCores())
clusterEvalQ(cl, library(Rpickands))
system.time({
  m1 <- parLapply(cl, 1:100,Take_expected_value, copy_number=100000,points=10000)
})
stopCluster(cl)

Time elapsted

user system elapsed

0.02 0.12 2697.75

Results

unlist(m1)
[1]  2.688238  3.837840  4.807498  5.884591  6.502143  7.555130  7.996165 10.431252 16.931074 14.523943 11.437245 10.686515
[13]  9.836119 16.181344 12.613655 14.128697 13.814877 12.070404 14.102493 14.536148 14.804475 10.947436 18.928591 11.983042
[25]  9.223853 14.318668 14.289090 13.160181 10.924543 10.826803 14.641171 24.728086 13.488865 27.190895 10.424461 10.903155
[37] 11.642132  9.866747 11.475512 11.697277 17.055357  9.944565  9.939114 14.062839 17.923098 11.323587 12.299989 10.989837
[49]  9.277263 11.610139 14.826962 10.755323 10.990754 17.035435 14.135412 17.228737 11.980655 15.485129 10.343445 11.065153
[61] 12.074058 15.573632 33.134251 14.213645 12.209484 11.390234 14.930856  9.718259 10.348547 12.342337 16.055808 12.495833
[73] 63.145002 16.760394 14.807204 19.350484 10.104475 12.499764 21.400678 14.524450 86.425498 13.142654 10.149432 11.246306
[85] 13.528511 14.126618 12.879850 10.520052 11.903952 36.904441 11.210756 10.848143 11.102669  9.512320 16.538452 10.293353
[97] 12.359468 10.996494 10.531604 11.170180

Plot of results -> unlist(m1)/1:100

rplot