Last updated: 2017-01-15

Code version: b05decc05714ddcb20aa04e56b557d5123d178fb

First, we load the necessary libraries.

library(ashr)
library(ggplot2)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Load the results of the simulation experiments, and generate the density data for all the simulation scenarios in a single data frame (“df”).

load("../output/dsc-shrink-files/res.RData")
PLOTSCENARIOS = c("spiky","near-normal","flat-top","skew","bimodal")
PLOTNAMES     = PLOTSCENARIOS

df = data.frame()
for(i in PLOTSCENARIOS) {
  s  = dsc_shrink$scenarios[[i]]
  g  = s$args$g
  x  = seq(-6,6,length = 100)
  y  = as.numeric(dens(g,x))
  df = rbind(df,data.frame(x = x,y = y,scenario = i))
}

df$scenario         = factor(df$scenario,levels = PLOTSCENARIOS)
levels(df$scenario) = PLOTNAMES

Generate density plots using ggplot.

ggplot(df,aes(x = x,y = y)) + 
  geom_line(size = 1.2,linetype = 1) + 
  facet_grid(.~scenario) + 
  ylab("density")

Session information

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.2

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] knitr_1.15.1  dplyr_0.5.0   ggplot2_2.2.0 ashr_2.0.5   

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8       dscr_0.1.1        plyr_1.8.4       
 [4] iterators_1.0.8   tools_3.3.2       digest_0.6.10    
 [7] evaluate_0.10     tibble_1.2        gtable_0.2.0     
[10] lattice_0.20-34   foreach_1.4.3     shiny_0.14.2     
[13] DBI_0.5-1         yaml_2.1.14       parallel_3.3.2   
[16] stringr_1.1.0     rprojroot_1.1     grid_3.3.2       
[19] R6_2.2.0          rmarkdown_1.3     reshape2_1.4.2   
[22] magrittr_1.5      backports_1.0.4   scales_0.4.1     
[25] codetools_0.2-15  htmltools_0.3.5   MASS_7.3-45      
[28] assertthat_0.1    xtable_1.8-2      mime_0.5         
[31] colorspace_1.2-6  httpuv_1.3.3      labeling_0.3     
[34] stringi_1.1.2     lazyeval_0.2.0    pscl_1.4.9       
[37] doParallel_1.0.10 munsell_0.4.3     truncnorm_1.0-7  
[40] SQUAREM_2016.8-2