Last updated: 2019-01-28
workflowr checks: (Click a bullet for more information) ✔ R Markdown file: up-to-date
Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.
✔ Environment: empty
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
✔ Seed:
set.seed(20180714)
The command set.seed(20180714)
was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.
✔ Session information: recorded
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
✔ Repository version: 5e3a6c1
wflow_publish
or wflow_git_commit
). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:
Ignored files:
Ignored: .DS_Store
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: docs/.DS_Store
Ignored: docs/figure/.DS_Store
Untracked files:
Untracked: analysis/gd_notes.Rmd
Untracked: code/pathways.R
Untracked: data/lowrank/
Untracked: data/tmp.rds
Untracked: data/tmp2.rds
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
I benchmark the rewritten my_etruncnorm
and my_vtruncnorm
against their counterparts in package truncnorm
. I expect truncnorm
to be a bit faster since it calls into C, but my hope is that the difference isn’t too noticeable.
devtools::load_all("~/Github/ashr")
Loading ashr
library(truncnorm)
do_benchmark <- function(ns, FUN1, FUN2) {
means <- matrix(0, nrow = 2, ncol = length(ns))
medians <- matrix(0, nrow = 2, ncol = length(ns))
for (i in 1:length(ns)) {
times = floor(10000000 / ns[i])
res <- microbenchmark::microbenchmark(FUN1(a, b),
FUN2(a, b),
setup = {
a = -abs(rnorm(ns[i]))
b = abs(rnorm(ns[i]))
},
times = times,
unit = "ms")
res <- summary(res)
means[, i] <- res$mean
medians[, i] <- res$median
}
return(list(means = means, medians = medians))
}
ns <- 10^seq(1, 6, by = 0.5)
res <- do_benchmark(ns, etruncnorm, my_etruncnorm)
ymin <- log10(min(c(res$means, res$medians)))
ymax <- log10(max(c(res$means, res$medians)))
plot(log10(ns), log10(res$means[2, ]), type = 'l', lty = 1, col = "red",
xlab = "log10(n)", ylab = "log10(ms)", ylim = c(ymin, ymax))
lines(log10(ns), log10(res$medians[2, ]), col = "red", lty = 2)
lines(log10(ns), log10(res$means[1, ]), col = "black", lty = 1)
lines(log10(ns), log10(res$medians[1, ]), col = "black", lty = 2)
legend("topleft", legend = c("my_etrunc (mean)", "my_etrunc (median)",
"etrunc (mean)", "etrunc (median)"),
lty = c(1, 2, 1, 2), col = c("red", "red", "black", "black"))
Version | Author | Date |
---|---|---|
5e3a6c1 | Jason Willwerscheid | 2019-01-26 |
res <- do_benchmark(ns, vtruncnorm, my_vtruncnorm)
ymin <- log10(min(c(res$means, res$medians)))
ymax <- log10(max(c(res$means, res$medians)))
plot(log10(ns), log10(res$means[2, ]), type = 'l', lty = 1, col = "red",
xlab = "log10(n)", ylab = "log10(ms)", ylim = c(ymin, ymax))
lines(log10(ns), log10(res$medians[2, ]), col = "red", lty = 2)
lines(log10(ns), log10(res$means[1, ]), col = "black", lty = 1)
lines(log10(ns), log10(res$medians[1, ]), col = "black", lty = 2)
legend("topleft", legend = c("my_vtrunc (mean)", "my_vtrunc (median)",
"vtrunc (mean)", "vtrunc (median)"),
lty = c(1, 2, 1, 2), col = c("red", "red", "black", "black"))
Version | Author | Date |
---|---|---|
5e3a6c1 | Jason Willwerscheid | 2019-01-26 |
sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.6
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] truncnorm_1.0-8 ashr_2.2-27
loaded via a namespace (and not attached):
[1] Rcpp_1.0.0 compiler_3.4.3 git2r_0.21.0
[4] workflowr_1.0.1 R.methodsS3_1.7.1 R.utils_2.6.0
[7] iterators_1.0.10 tools_3.4.3 testthat_2.0.1
[10] digest_0.6.18 etrunct_0.1 evaluate_0.12
[13] memoise_1.1.0 lattice_0.20-35 rlang_0.3.0.1
[16] Matrix_1.2-14 foreach_1.4.4 microbenchmark_1.4-6
[19] commonmark_1.4 yaml_2.2.0 parallel_3.4.3
[22] mvtnorm_1.0-7 xfun_0.4 withr_2.1.2.9000
[25] stringr_1.3.1 roxygen2_6.0.1.9000 xml2_1.2.0
[28] knitr_1.21.6 devtools_1.13.4 rprojroot_1.3-2
[31] grid_3.4.3 R6_2.3.0 survival_2.41-3
[34] rmarkdown_1.11 multcomp_1.4-8 mixsqp_0.1-93
[37] TH.data_1.0-8 magrittr_1.5 whisker_0.3-2
[40] splines_3.4.3 backports_1.1.2 codetools_0.2-15
[43] htmltools_0.3.6 MASS_7.3-48 assertthat_0.2.0
[46] sandwich_2.4-0 stringi_1.2.4 doParallel_1.0.14
[49] pscl_1.5.2 SQUAREM_2017.10-1 zoo_1.8-1
[52] R.oo_1.21.0
This reproducible R Markdown analysis was created with workflowr 1.0.1