Last updated: 2017-01-15

Code version: b05decc05714ddcb20aa04e56b557d5123d178fb

First, we load the necessary libraries, and specify settings for displaying the plots in the rendered document.

library(magrittr)
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
source("../R/set_plot_colors.R")

Generate scatterplots compare the estimated estimate of pi0 against the ground-truth value, colored by the method used, and split by the scenario type.

load("../output/dsc-shrink-files/res.RData")

PLOTMETHODS   = c("mixfdr.tnull","ash.n","ash.u","qvalue","locfdr")
PLOTSCENARIOS = c("spiky","near-normal","flat-top","skew","bimodal")
PLOTNAMES     = PLOTSCENARIOS
ALPHALEVEL    = 0.8 # controls transparency

df = res$pi0_score %>% 
       filter(scenario %in% PLOTSCENARIOS) %>% 
       filter(method %in% PLOTMETHODS)
df$scenario = factor(df$scenario,levels=PLOTSCENARIOS)
levels(df$scenario) = PLOTNAMES

pi0_plot = ggplot(df,aes(pi0,pi0_est,colour = method,alpha = ALPHALEVEL)) +
  geom_point(shape = 1) +
  facet_grid(. ~ scenario) + 
  guides(alpha = FALSE) +
  geom_abline(colour = "black") +
  xlab("True pi0") +
  ylab("Estimated pi0") 
print(pi0_plot + scale_y_continuous(limits = c(0,1.01)) +
        scale_x_continuous(limits = c(0,1.01)) +
        coord_equal(ratio = 1) + 
        colScale + 
        theme(legend.position = "top",
              axis.text.x     = element_text(size = 8,angle = 45)))

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       ggplot2_2.2.0      RColorBrewer_1.1-2
[4] dplyr_0.5.0        magrittr_1.5      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8      munsell_0.4.3    xtable_1.8-2     colorspace_1.2-6
 [5] R6_2.2.0         stringr_1.1.0    plyr_1.8.4       tools_3.3.2     
 [9] grid_3.3.2       gtable_0.2.0     DBI_0.5-1        dscr_0.1.1      
[13] htmltools_0.3.5  yaml_2.1.14      lazyeval_0.2.0   assertthat_0.1  
[17] rprojroot_1.1    digest_0.6.10    tibble_1.2       shiny_0.14.2    
[21] reshape2_1.4.2   mime_0.5         evaluate_0.10    rmarkdown_1.3   
[25] labeling_0.3     stringi_1.1.2    scales_0.4.1     backports_1.0.4 
[29] httpuv_1.3.3