All the tests were done on an Arch Linux x86_64 machine with an Intel(R) Core(TM) i7 CPU (1.90GHz).
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.
We fix the number of parameters at p = 10, and simulate the parameter
value and n × p
matrices using rnorm()
. In order to ensure convergence with
a large n, 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 450.291 474.3705 511.3841 492.996 550.3975 617.253
#> n1e3 1194.070 1391.0525 1568.3820 1481.782 1610.7080 5224.245
#> n1e4 10692.266 12780.2945 14650.6895 15086.896 16012.7005 19175.226
#> n1e5 160458.100 185052.6445 219784.8717 216360.400 249081.4585 354283.365
#> neval cld
#> 100 a
#> 100 a
#> 100 b
#> 100 c
autoplot(result)
This time we fix the number of observations at n = 1000, 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
#> p5 721.578 768.4905 839.9781 808.2595 847.923 3625.139
#> p25 2879.367 2938.7175 3167.8634 2993.0885 3040.002 10522.489
#> p100 23331.055 25989.4295 28190.3520 26608.6655 30984.145 47209.704
#> p400 269300.207 294531.3165 328788.9763 316116.2565 341653.366 509396.514
#> neval cld
#> 100 a
#> 100 a
#> 100 b
#> 100 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.