Last updated: 2020-06-04

Checks: 7 0

Knit directory: mmbr-rss-dsc/

This reproducible R Markdown analysis was created with workflowr (version 1.6.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


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.

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.

The command set.seed(20200227) 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.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version c260391. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use 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:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  code/investigate_missing.R
    Untracked:  investigate_missing_simple.rds
    Untracked:  investigate_time.log
    Untracked:  output/mnm_missing_output.20200527.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.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/mmbr_rss_missing_1.Rmd) and HTML (docs/mmbr_rss_missing_1.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
Rmd c260391 zouyuxin 2020-06-04 wflow_publish(“analysis/mmbr_rss_missing_1.Rmd”)
html abefbb2 zouyuxin 2020-05-28 Build site.
Rmd ea18305 zouyuxin 2020-05-28 wflow_publish(“analysis/mmbr_rss_missing_1.Rmd”)
html 8551a51 zouyuxin 2020-05-28 Build site.
Rmd cda914c zouyuxin 2020-05-28 wflow_publish(“analysis/mmbr_rss_missing_1.Rmd”)

This is result with missing values. There are 500 datasets, each with 300 SNPs. There are 6 conditions and we generate signals using artificial priors (details). We fit with oracle prior and residual variance. We estimate prior weights using ‘simple’ method (comparing with 0).

library(dplyr)
library(kableExtra)
library(knitr)
out = readRDS('output/mnm_missing_output.20200527.rds')
res = out[,-c(1:2)]
colnames(res) = c('missingY', 'method', 'prior.scale', 'time', 'total', 'valid', 'size', 'purity', 'top_hit', 'total_true', 'total_true_included', 'overlap_var', 'overlap_cs', 'false_positive_cross_cond', 'false_negative_cross_cond', 'true_positive_cross_cond', 'converged', 'filename')
rss.out = res %>% filter(!is.na(prior.scale))
rm(out)
rm(res)

Purity

purity = aggregate(purity~missingY+prior.scale, rss.out, mean)
purity
  missingY prior.scale    purity
1    FALSE      oracle 0.9572299
2     TRUE      oracle 0.9766140
3    FALSE   simulated 0.9315083
4     TRUE   simulated 0.9403023

Power

total_true_included = aggregate(total_true_included ~ missingY+prior.scale, rss.out, sum)
total_true = aggregate(total_true ~ missingY+prior.scale, rss.out, sum)
cs_overlap = aggregate(overlap_cs ~ missingY+prior.scale, rss.out, sum)
snp_overlap = aggregate(overlap_var ~ missingY+prior.scale, rss.out, sum)
power = merge(total_true_included, total_true, by = c('missingY', 'prior.scale'))
power = merge(power, cs_overlap,  by = c('missingY', 'prior.scale'))
power = merge(power, snp_overlap,  by = c('missingY', 'prior.scale'))
power$power = round(power$total_true_included/power$total_true,3)
power$overlap_cs = round(power$overlap_cs, 3)
power$overlap_var = round(power$overlap_var, 3)
knitr::kable(power) %>% kable_styling(full_width = F)
missingY prior.scale total_true_included total_true overlap_cs overlap_var power
FALSE oracle 1481 3000 41 405 0.494
FALSE simulated 1403 3000 1961 55376 0.468
TRUE oracle 1051 3000 8 189 0.350
TRUE simulated 1173 3000 1014 34338 0.391

FDR

valid = aggregate(valid ~ missingY+prior.scale, rss.out, sum)
total = aggregate(total ~ missingY+prior.scale, rss.out, sum)
fdr = merge(valid, total, by = c( 'missingY', 'prior.scale'))
fdr$fdr = round((fdr$total - fdr$valid)/fdr$total,3)
knitr::kable(fdr) %>% kable_styling(full_width = F)
missingY prior.scale valid total fdr
FALSE oracle 1482 1900 0.220
FALSE simulated 2249 2312 0.027
TRUE oracle 1031 1304 0.209
TRUE simulated 1646 1718 0.042

sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/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] knitr_1.28       kableExtra_1.1.0 dplyr_0.8.5      workflowr_1.6.1 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6      highr_0.8         compiler_3.6.3    pillar_1.4.3     
 [5] later_1.0.0       git2r_0.26.1      tools_3.6.3       digest_0.6.25    
 [9] viridisLite_0.3.0 evaluate_0.14     tibble_3.0.1      lifecycle_0.2.0  
[13] pkgconfig_2.0.3   rlang_0.4.6       rstudioapi_0.11   yaml_2.2.1       
[17] xfun_0.13         stringr_1.4.0     httr_1.4.1        xml2_1.3.2       
[21] fs_1.4.1          vctrs_0.3.0       hms_0.5.3         webshot_0.5.2    
[25] rprojroot_1.3-2   tidyselect_1.0.0  glue_1.4.1        R6_2.4.1         
[29] rmarkdown_2.1     purrr_0.3.4       readr_1.3.1       magrittr_1.5     
[33] whisker_0.4       backports_1.1.6   scales_1.1.0      promises_1.1.0   
[37] ellipsis_0.3.1    htmltools_0.4.0   assertthat_0.2.1  rvest_0.3.5      
[41] colorspace_1.4-1  httpuv_1.5.2      stringi_1.4.6     munsell_0.5.0    
[45] crayon_1.3.4