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 neval
#> n1e2 443.898 467.917 508.2046 481.583 551.3335 829.387 100
#> n1e3 1210.157 1377.254 1555.1301 1463.113 1577.9175 5008.771 100
#> n1e4 10613.985 12537.618 14634.4468 14927.440 15774.0330 24110.885 100
#> n1e5 157769.051 183291.655 215934.3324 210973.629 244141.5165 326851.140 100
#> cld
#> a
#> a
#> b
#> 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 713.320 758.0035 819.0166 781.498 813.9625 3731.98 100
#> p25 2850.345 2896.1760 3123.4208 2931.341 2990.1365 11172.22 100
#> p100 23127.081 25649.7260 27754.4474 26208.898 30666.4215 46321.64 100
#> p400 265057.349 290618.1930 323761.4665 309898.365 337721.2925 498721.93 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.