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
#> n1e2 448.296 484.624 516.6993 501.1445 548.5885 627.561
#> n1e3 1209.426 1411.318 1516.4578 1499.2110 1587.1655 2624.425
#> n1e4 10716.849 12327.078 14431.6034 14722.1305 15837.9365 19154.016
#> n1e5 168660.552 201714.250 235261.4350 228490.0490 254308.6870 369763.718
#> neval cld
#> 100 a
#> 100 a
#> 100 b
#> 100 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 731.875 769.1595 809.7365 796.8165 851.188 976.001
#> p25 2902.244 2947.1970 3113.3180 2988.7500 3050.320 6387.264
#> p100 23382.834 25894.5890 28029.9008 26269.4285 30851.962 46900.681
#> p400 266563.765 292522.5595 328469.3686 313541.0595 350069.032 545359.636
#> 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.
