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 neval
#> n1e2 436.735 465.0225 502.8936 480.812 542.928 843.073 100
#> n1e3 1134.407 1355.1685 1460.8349 1425.409 1531.273 2546.661 100
#> n1e4 10471.306 12608.6385 15814.0579 14790.614 15631.764 91007.641 100
#> n1e5 158884.577 202067.3070 240021.9878 243431.840 271673.720 338583.196 100
#> cld
#> a
#> a
#> b
#> 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
#> p5 709.313 742.9255 869.0745 773.518 813.0065 3942.856
#> p25 2710.086 2759.2780 2925.6140 2784.164 2853.3790 5829.746
#> p100 21089.847 23618.7200 25835.1865 24241.311 28653.7635 46392.544
#> p400 236172.140 261685.7810 295799.2108 282959.897 317499.3360 472354.260
#> 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.