knitr::opts_chunk$set(echo = TRUE, cache = TRUE)
This is a short effort to give users an idea of how long the functions take to process. The benchmarks were performed using the default R install on Travis CI.
Note: the benchmarks -- particularly ADMMsigma
-- run significantly faster on my personal machine (MacBook Pro Late 2016). In most cases, the processes take $\approx$ 25\% of the time.
We will be estimating a tri-diagonal precision matrix with dimension $p = 100$:
\vspace{0.5cm}
library(ADMMsigma) library(microbenchmark) # generate data from tri-diagonal (sparse) matrix # compute covariance matrix (can confirm inverse is tri-diagonal) S = matrix(0, nrow = 100, ncol = 100) for (i in 1:100){ for (j in 1:100){ S[i, j] = 0.7^(abs(i - j)) } } # generate 1000 x 100 matrix with rows drawn from iid N_p(0, S) set.seed(123) Z = matrix(rnorm(1000*100), nrow = 1000, ncol = 100) out = eigen(S, symmetric = TRUE) S.sqrt = out$vectors %*% diag(out$values^0.5) %*% t(out$vectors) X = Z %*% S.sqrt # calculate sample covariance matrix Sample = (nrow(X) - 1)/nrow(X)*cov(X)
\vspace{0.5cm}
\vspace{0.5cm}
# benchmark ADMMsigma - default tolerance microbenchmark(ADMMsigma(S = Sample, lam = 0.1, alpha = 1, tol.abs = 1e-4, tol.rel = 1e-4, trace = "none"))
\vspace{0.5cm}
\vspace{0.5cm}
# benchmark ADMMsigma - tolerance 1e-8 microbenchmark(ADMMsigma(S = Sample, lam = 0.1, alpha = 1, tol.abs = 1e-8, tol.rel = 1e-8, trace = "none"))
\vspace{0.5cm}
lam
and alpha
:
\vspace{0.5cm}
# benchmark ADMMsigma CV - default parameter grid microbenchmark(ADMMsigma(X, trace = "none"), times = 5)
\vspace{0.5cm}
cores = 2
) cross validation:
\vspace{0.5cm}
# benchmark ADMMsigma parallel CV microbenchmark(ADMMsigma(X, cores = 2, trace = "none"), times = 5)
\vspace{0.5cm}
\vspace{0.5cm}
# benchmark ADMMsigma CV - likelihood convergence criteria microbenchmark(ADMMsigma(X, crit = "loglik", trace = "none"), times = 5)
\vspace{0.5cm}
RIDGEsigma
with fine parameter grid:
\vspace{0.5cm}
# benchmark RIDGEsigma CV microbenchmark(RIDGEsigma(X, lam = 10^seq(-8, 8, 0.01), trace = "none"), times = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.