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 \times 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 471.208 534.686 642.0046 590.6805 663.5565 2547.809
#> n1e3 1306.451 1543.368 1865.0289 1753.3175 1948.1420 4835.856
#> n1e4 11980.556 15318.528 18041.1383 17403.4760 19572.6080 34205.827
#> n1e5 249800.349 300236.748 363823.3686 351242.7685 410751.0255 677121.897
#> 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 neval
#> p5 836.605 957.967 1173.603 1034.581 1146.942 3507.973 100
#> p25 2972.009 3434.618 3974.785 3608.974 4209.010 7394.445 100
#> p100 24543.118 30161.395 34809.507 32883.622 38059.852 59219.304 100
#> p400 313662.409 361374.363 411516.334 388878.859 456629.373 673508.962 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.