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 465.678 506.369 559.3217 557.620 607.1425 754.787 100
#> n1e3 1195.100 1449.303 1570.1170 1534.537 1660.3610 2714.692 100
#> n1e4 11134.506 12784.237 15077.9767 15410.175 16540.7925 21501.439 100
#> n1e5 180928.122 218263.285 253547.7375 244287.308 273499.6630 429929.306 100
#> cld
#> a
#> a
#> b
#> c
autoplot(result)
#> Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
#> ℹ Please use tidy evaluation idioms with `aes()`.
#> ℹ See also `vignette("ggplot2-in-packages")` for more information.
#> ℹ The deprecated feature was likely used in the microbenchmark package.
#> Please report the issue at
#> <https://github.com/joshuaulrich/microbenchmark/issues/>.
#> This warning is displayed once per session.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.
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 728.338 801.5155 889.0228 854.4235 901.6215 4623.864
#> p25 2817.665 2896.8375 3031.3995 3005.9360 3070.5965 6780.194
#> p100 22031.297 24659.5240 26886.2712 25113.9410 29711.1250 45891.396
#> p400 245384.680 270880.8490 306264.5269 293090.3535 331581.8935 446844.972
#> 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.
