All the tests were done on an Arch Linux x86_64 machine with an Intel(R) Core(TM) i7 CPU (1.90GHz).
Empirical likelihood computation
We show the performance of computing empirical likelihood with
el_mean()
. We test the computation speed with simulated
data sets in two different settings: 1) the number of observations
increases with the number of parameters fixed, and 2) the number of
parameters increases with the number of observations fixed.
Increasing the number of observations
We fix the number of parameters at
,
and simulate the parameter value and
matrices using rnorm()
. In order to ensure convergence with
a large
,
we set a large threshold value using el_control()
.
library(ggplot2)
library(microbenchmark)
set.seed(3175775)
p <- 10
par <- rnorm(p, sd = 0.1)
ctrl <- el_control(th = 1e+10)
result <- microbenchmark(
n1e2 = el_mean(matrix(rnorm(100 * p), ncol = p), par = par, control = ctrl),
n1e3 = el_mean(matrix(rnorm(1000 * p), ncol = p), par = par, control = ctrl),
n1e4 = el_mean(matrix(rnorm(10000 * p), ncol = p), par = par, control = ctrl),
n1e5 = el_mean(matrix(rnorm(100000 * p), ncol = p), par = par, control = ctrl)
)
Below are the results:
result
#> Unit: microseconds
#> expr min lq mean median uq max
#> n1e2 429.511 464.0795 493.6927 480.675 507.9415 620.325
#> n1e3 1130.506 1340.7825 1443.9696 1413.803 1535.0800 2291.118
#> n1e4 10379.826 12634.8875 15577.4431 14672.002 15555.0380 85805.068
#> n1e5 160536.536 201405.9760 236683.7819 235374.562 274470.7995 322274.589
#> neval cld
#> 100 a
#> 100 a
#> 100 b
#> 100 c
autoplot(result)
Increasing the number of parameters
This time we fix the number of observations at , and evaluate empirical likelihood at zero vectors of different sizes.
n <- 1000
result2 <- microbenchmark(
p5 = el_mean(matrix(rnorm(n * 5), ncol = 5),
par = rep(0, 5),
control = ctrl
),
p25 = el_mean(matrix(rnorm(n * 25), ncol = 25),
par = rep(0, 25),
control = ctrl
),
p100 = el_mean(matrix(rnorm(n * 100), ncol = 100),
par = rep(0, 100),
control = ctrl
),
p400 = el_mean(matrix(rnorm(n * 400), ncol = 400),
par = rep(0, 400),
control = ctrl
)
)
result2
#> Unit: microseconds
#> expr min lq mean median uq max neval
#> p5 696.849 737.9245 820.9745 762.4255 781.05 3683.382 100
#> p25 2713.555 2765.2015 2950.3288 2793.8500 2842.44 5801.608 100
#> p100 21087.554 23607.1080 25812.4630 24086.3610 28580.33 46488.955 100
#> p400 236349.809 260017.6655 294741.6930 282436.8500 310713.81 465667.908 100
#> cld
#> a
#> a
#> b
#> c
autoplot(result2)
On average, evaluating empirical likelihood with a 100000×10 or 1000×400 matrix at a parameter value satisfying the convex hull constraint takes less than a second.