Last updated: 2020-03-13

Checks: 7 0

Knit directory: mmbr-rss-dsc/

This reproducible R Markdown analysis was created with workflowr (version 1.6.0). 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 version displayed above was the version of the Git repository at the time these results were generated.

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:


Untracked files:
    Untracked:  output/mnm_rss_lite_output.20200227.rds
    Untracked:  output/mnm_rss_lite_output.20200310.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 R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view them.

File Version Author Date Message
Rmd 0de6e05 zouyuxin 2020-03-13 wflow_publish(“analysis/mmbr_rss_simulation_2.Rmd”)

This is result from our second M&M RSS simulation.

There are 300 data sets using GTEx genotypes. The number of conditions are 5 and 10. The model are fitted with oracle prior and residual variance.

library(dplyr)
library(kableExtra)
library(knitr)
out = readRDS('output/mnm_rss_lite_output.20200310.rds')
res = out[,-1]
colnames(res) = c('n_traits', 'simulate', 'method', 'resid_method', 'L', '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')
rm(out)
res = res %>% filter(resid_method == 'oracle')
res.shared = res %>% filter(simulate == 'shared', grepl('shared', res$method))
res.singleton = res %>% filter(simulate == 'singleton', grepl('singleton', res$method))
res.mid_het = res %>% filter(simulate == 'mid_het', grepl('mid_het', res$method))
res.mix = res %>% filter(simulate == 'mixture01', grepl('mixture01', res$method))

Shared

Purity

purity = aggregate(purity~n_traits + method + L, res.shared, mean)
purity = purity[order(purity$n_traits, purity$L),]
rownames(purity) = NULL
knitr::kable(purity) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L purity
5 mnm_rss_shared 1 0.9898494
5 mnm_shared 1 0.9895356
5 mnm_rss_shared 2 0.9846422
5 mnm_shared 2 0.9853774
5 mnm_rss_shared 10 0.9838465
5 mnm_shared 10 0.9838652
10 mnm_rss_shared 1 0.9972510
10 mnm_shared 1 0.9972127
10 mnm_rss_shared 2 0.9941276
10 mnm_shared 2 0.9948094
10 mnm_rss_shared 10 0.9935605
10 mnm_shared 10 0.9938060

Power

total_true_included = aggregate(total_true_included ~ n_traits + method + L, res.shared, sum)
total_true = aggregate(total_true ~  n_traits + method + L, res.shared, sum)
cs_overlap = aggregate(overlap_cs ~  n_traits + method + L, res.shared, sum)
snp_overlap = aggregate(overlap_var ~  n_traits + method + L, res.shared, sum)
power = merge(total_true_included, total_true, by = c( 'n_traits', 'method' , 'L'))
power = merge(power, cs_overlap,  by = c( 'n_traits', 'method' , 'L'))
power = merge(power, snp_overlap,  by = c( 'n_traits', 'method' , 'L'))
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)
power = power[order(power$n_traits, power$L, power$method),]
rownames(power) = NULL
knitr::kable(power) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L total_true_included total_true overlap_cs overlap_var power
5 mnm_rss_shared 1 291 527 0 0 0.552
5 mnm_shared 1 298 527 0 0 0.565
5 mnm_rss_shared 2 410 527 0 0 0.778
5 mnm_shared 2 416 527 0 0 0.789
5 mnm_rss_shared 10 422 527 13 80 0.801
5 mnm_shared 10 429 527 10 74 0.814
10 mnm_rss_shared 1 273 501 0 0 0.545
10 mnm_shared 1 284 501 0 0 0.567
10 mnm_rss_shared 2 373 501 0 0 0.745
10 mnm_shared 2 385 501 0 0 0.768
10 mnm_rss_shared 10 405 501 17 73 0.808
10 mnm_shared 10 415 501 11 51 0.828

FDR

valid = aggregate(valid ~ n_traits + method + L, res.shared, sum)
total = aggregate(total ~ n_traits + method + L, res.shared, sum)
fdr = merge(valid, total, by = c( 'n_traits', 'method', 'L'))
fdr$fdr = round((fdr$total - fdr$valid)/fdr$total,3)
fdr = fdr[order(fdr$n_traits, fdr$L, fdr$method),]
rownames(fdr) = NULL
knitr::kable(fdr) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L valid total fdr
5 mnm_rss_shared 1 280 299 0.064
5 mnm_shared 1 287 299 0.040
5 mnm_rss_shared 2 395 417 0.053
5 mnm_shared 2 403 413 0.024
5 mnm_rss_shared 10 419 449 0.067
5 mnm_shared 10 426 442 0.036
10 mnm_rss_shared 1 271 300 0.097
10 mnm_shared 1 281 300 0.063
10 mnm_rss_shared 2 371 411 0.097
10 mnm_shared 2 381 411 0.073
10 mnm_rss_shared 10 415 466 0.109
10 mnm_shared 10 419 458 0.085

Convergence

elbo_converged = aggregate(converged~n_traits + method + L, res.shared, mean)
elbo_converged = elbo_converged[which(elbo_converged$L!=1),]
elbo_converged = elbo_converged[order(elbo_converged$n_traits),]
rownames(elbo_converged) = NULL
knitr::kable(elbo_converged) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:4), background = "wheat")
n_traits method L converged
5 mnm_rss_shared 2 0.9933333
5 mnm_shared 2 0.9533333
5 mnm_rss_shared 10 0.7066667
5 mnm_shared 10 0.6966667
10 mnm_rss_shared 2 0.9900000
10 mnm_shared 2 0.9766667
10 mnm_rss_shared 10 0.7266667
10 mnm_shared 10 0.7200000

Singleton

Purity

purity = aggregate(purity~n_traits + method + L, res.singleton, mean)
purity = purity[order(purity$n_traits, purity$L),]
rownames(purity) = NULL
knitr::kable(purity) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L purity
5 mnm_rss_singleton 1 0.8778953
5 mnm_singleton 1 0.8673773
5 mnm_rss_singleton 2 0.9201027
5 mnm_singleton 2 0.9172359
5 mnm_rss_singleton 10 0.9125635
5 mnm_singleton 10 0.9127821
10 mnm_rss_singleton 1 0.8480943
10 mnm_singleton 1 0.8288053
10 mnm_rss_singleton 2 0.9344460
10 mnm_singleton 2 0.9203271
10 mnm_rss_singleton 10 0.9302034
10 mnm_singleton 10 0.9156067

Power

total_true_included = aggregate(total_true_included ~ n_traits + method + L, res.singleton, sum)
total_true = aggregate(total_true ~  n_traits + method + L, res.singleton, sum)
cs_overlap = aggregate(overlap_cs ~  n_traits + method + L, res.singleton, sum)
snp_overlap = aggregate(overlap_var ~  n_traits + method + L, res.singleton, sum)
power = merge(total_true_included, total_true, by = c( 'n_traits', 'method' , 'L'))
power = merge(power, cs_overlap,  by = c( 'n_traits', 'method' , 'L'))
power = merge(power, snp_overlap,  by = c( 'n_traits', 'method' , 'L'))
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)
power = power[order(power$n_traits, power$L, power$method),]
rownames(power) = NULL
knitr::kable(power) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L total_true_included total_true overlap_cs overlap_var power
5 mnm_rss_singleton 1 273 487 0 0 0.561
5 mnm_singleton 1 275 487 0 0 0.565
5 mnm_rss_singleton 2 381 487 10 184 0.782
5 mnm_singleton 2 385 487 11 218 0.791
5 mnm_rss_singleton 10 395 487 14 232 0.811
5 mnm_singleton 10 401 487 15 276 0.823
10 mnm_rss_singleton 1 279 498 0 0 0.560
10 mnm_singleton 1 276 498 0 0 0.554
10 mnm_rss_singleton 2 415 498 14 195 0.833
10 mnm_singleton 2 410 498 14 211 0.823
10 mnm_rss_singleton 10 424 498 20 290 0.851
10 mnm_singleton 10 418 498 20 315 0.839

FDR

valid = aggregate(valid ~ n_traits + method + L, res.singleton, sum)
total = aggregate(total ~ n_traits + method + L, res.singleton, sum)
fdr = merge(valid, total, by = c( 'n_traits', 'method', 'L'))
fdr$fdr = round((fdr$total - fdr$valid)/fdr$total,3)
fdr = fdr[order(fdr$n_traits, fdr$L, fdr$method),]
rownames(fdr) = NULL
knitr::kable(fdr) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L valid total fdr
5 mnm_rss_singleton 1 263 277 0.051
5 mnm_singleton 1 264 275 0.040
5 mnm_rss_singleton 2 376 394 0.046
5 mnm_singleton 2 380 393 0.033
5 mnm_rss_singleton 10 391 411 0.049
5 mnm_singleton 10 397 411 0.034
10 mnm_rss_singleton 1 261 268 0.026
10 mnm_singleton 1 258 264 0.023
10 mnm_rss_singleton 2 408 421 0.031
10 mnm_singleton 2 404 415 0.027
10 mnm_rss_singleton 10 421 434 0.030
10 mnm_singleton 10 416 427 0.026

Convergence

elbo_converged = aggregate(converged~n_traits + method + L, res.singleton, mean)
elbo_converged = elbo_converged[which(elbo_converged$L!=1),]
elbo_converged = elbo_converged[order(elbo_converged$n_traits),]
rownames(elbo_converged) = NULL
knitr::kable(elbo_converged) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:4), background = "wheat")
n_traits method L converged
5 mnm_rss_singleton 2 0.9800000
5 mnm_singleton 2 0.9733333
5 mnm_rss_singleton 10 0.7733333
5 mnm_singleton 10 0.7533333
10 mnm_rss_singleton 2 0.9833333
10 mnm_singleton 2 0.9566667
10 mnm_rss_singleton 10 0.7633333
10 mnm_singleton 10 0.7333333

Mid heterogeneity

Purity

purity = aggregate(purity~n_traits + method + L, res.mid_het, mean)
purity = purity[order(purity$n_traits, purity$L),]
rownames(purity) = NULL
knitr::kable(purity) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L purity
5 mnm_mid_het 1 0.9872006
5 mnm_rss_mid_het 1 0.9881342
5 mnm_mid_het 2 0.9904160
5 mnm_rss_mid_het 2 0.9913746
5 mnm_mid_het 10 0.9906158
5 mnm_rss_mid_het 10 0.9917301
10 mnm_mid_het 1 0.9965997
10 mnm_rss_mid_het 1 0.9975002
10 mnm_mid_het 2 0.9956400
10 mnm_rss_mid_het 2 0.9961010
10 mnm_mid_het 10 0.9958651
10 mnm_rss_mid_het 10 0.9961145

Power

total_true_included = aggregate(total_true_included ~ n_traits + method + L, res.mid_het, sum)
total_true = aggregate(total_true ~  n_traits + method + L, res.mid_het, sum)
cs_overlap = aggregate(overlap_cs ~  n_traits  + method + L, res.mid_het, sum)
snp_overlap = aggregate(overlap_var ~  n_traits  + method + L, res.mid_het, sum)
power = merge(total_true_included, total_true, by = c( 'n_traits', 'method' , 'L'))
power = merge(power, cs_overlap,  by = c( 'n_traits', 'method' , 'L'))
power = merge(power, snp_overlap,  by = c( 'n_traits', 'method' , 'L'))
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)
power = power[order(power$n_traits, power$L, power$method),]
rownames(power) = NULL
knitr::kable(power) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L total_true_included total_true overlap_cs overlap_var power
5 mnm_mid_het 1 292 513 0 0 0.569
5 mnm_rss_mid_het 1 283 513 0 0 0.552
5 mnm_mid_het 2 415 513 0 0 0.809
5 mnm_rss_mid_het 2 410 513 0 0 0.799
5 mnm_mid_het 10 443 513 3 33 0.864
5 mnm_rss_mid_het 10 439 513 3 31 0.856
10 mnm_mid_het 1 297 510 0 0 0.582
10 mnm_rss_mid_het 1 289 510 0 0 0.567
10 mnm_mid_het 2 424 510 0 0 0.831
10 mnm_rss_mid_het 2 418 510 0 0 0.820
10 mnm_mid_het 10 454 510 5 21 0.890
10 mnm_rss_mid_het 10 448 510 8 42 0.878

FDR

valid = aggregate(valid ~ n_traits + method + L, res.mid_het, sum)
total = aggregate(total ~ n_traits + method + L, res.mid_het, sum)
fdr = merge(valid, total, by = c( 'n_traits', 'method', 'L'))
fdr$fdr = round((fdr$total - fdr$valid)/fdr$total,3)
fdr = fdr[order(fdr$n_traits, fdr$L, fdr$method),]
rownames(fdr) = NULL
knitr::kable(fdr) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L valid total fdr
5 mnm_mid_het 1 285 298 0.044
5 mnm_rss_mid_het 1 277 298 0.070
5 mnm_mid_het 2 406 427 0.049
5 mnm_rss_mid_het 2 402 430 0.065
5 mnm_mid_het 10 437 459 0.048
5 mnm_rss_mid_het 10 434 464 0.065
10 mnm_mid_het 1 290 300 0.033
10 mnm_rss_mid_het 1 282 300 0.060
10 mnm_mid_het 2 417 435 0.041
10 mnm_rss_mid_het 2 410 436 0.060
10 mnm_mid_het 10 452 473 0.044
10 mnm_rss_mid_het 10 445 478 0.069

Convergence

elbo_converged = aggregate(converged~n_traits + method + L, res.mid_het, mean)
elbo_converged = elbo_converged[which(elbo_converged$L!=1),]
elbo_converged = elbo_converged[order(elbo_converged$n_traits),]
rownames(elbo_converged) = NULL
knitr::kable(elbo_converged) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:4), background = "wheat")
n_traits method L converged
5 mnm_mid_het 2 0.9600000
5 mnm_rss_mid_het 2 0.9900000
5 mnm_mid_het 10 0.6600000
5 mnm_rss_mid_het 10 0.6766667
10 mnm_mid_het 2 0.9400000
10 mnm_rss_mid_het 2 0.9933333
10 mnm_mid_het 10 0.6066667
10 mnm_rss_mid_het 10 0.6633333

Mixture

Purity

purity = aggregate(purity~n_traits + method + L, res.mix, mean)
purity = purity[order(purity$n_traits, purity$L),]
rownames(purity) = NULL
knitr::kable(purity) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L purity
5 mnm_mixture01 1 0.9783740
5 mnm_rss_mixture01 1 0.9750908
5 mnm_mixture01 2 0.9825720
5 mnm_rss_mixture01 2 0.9846230
5 mnm_mixture01 10 0.9827268
5 mnm_rss_mixture01 10 0.9846824
10 mnm_mixture01 1 0.9865030
10 mnm_rss_mixture01 1 0.9877358
10 mnm_mixture01 2 0.9891677
10 mnm_rss_mixture01 2 0.9908808
10 mnm_mixture01 10 0.9889556
10 mnm_rss_mixture01 10 0.9907812

Power

total_true_included = aggregate(total_true_included ~ n_traits + method + L, res.mix, sum)
total_true = aggregate(total_true ~  n_traits + method + L, res.mix, sum)
cs_overlap = aggregate(overlap_cs ~  n_traits  + method + L, res.mix, sum)
snp_overlap = aggregate(overlap_var ~  n_traits  + method + L, res.mix, sum)
power = merge(total_true_included, total_true, by = c( 'n_traits', 'method' , 'L'))
power = merge(power, cs_overlap,  by = c( 'n_traits', 'method' , 'L'))
power = merge(power, snp_overlap,  by = c( 'n_traits', 'method' , 'L'))
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)
power = power[order(power$n_traits, power$L, power$method),]
rownames(power) = NULL
knitr::kable(power) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L total_true_included total_true overlap_cs overlap_var power
5 mnm_mixture01 1 303 510 0 0 0.594
5 mnm_rss_mixture01 1 294 510 0 0 0.576
5 mnm_mixture01 2 401 510 0 0 0.786
5 mnm_rss_mixture01 2 392 510 0 0 0.769
5 mnm_mixture01 10 417 510 3 16 0.818
5 mnm_rss_mixture01 10 407 510 4 20 0.798
10 mnm_mixture01 1 295 511 0 0 0.577
10 mnm_rss_mixture01 1 287 511 0 0 0.562
10 mnm_mixture01 2 407 511 0 0 0.796
10 mnm_rss_mixture01 2 398 511 0 0 0.779
10 mnm_mixture01 10 433 511 2 7 0.847
10 mnm_rss_mixture01 10 424 511 4 27 0.830

FDR

valid = aggregate(valid ~ n_traits + method + L, res.mix, sum)
total = aggregate(total ~ n_traits + method + L, res.mix, sum)
fdr = merge(valid, total, by = c( 'n_traits', 'method', 'L'))
fdr$fdr = round((fdr$total - fdr$valid)/fdr$total,3)
fdr = fdr[order(fdr$n_traits, fdr$L, fdr$method),]
rownames(fdr) = NULL
knitr::kable(fdr) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:6), background = "wheat")
n_traits method L valid total fdr
5 mnm_mixture01 1 287 298 0.037
5 mnm_rss_mixture01 1 280 297 0.057
5 mnm_mixture01 2 384 400 0.040
5 mnm_rss_mixture01 2 378 401 0.057
5 mnm_mixture01 10 403 421 0.043
5 mnm_rss_mixture01 10 397 424 0.064
10 mnm_mixture01 1 290 299 0.030
10 mnm_rss_mixture01 1 282 298 0.054
10 mnm_mixture01 2 401 416 0.036
10 mnm_rss_mixture01 2 392 416 0.058
10 mnm_mixture01 10 428 447 0.043
10 mnm_rss_mixture01 10 421 450 0.064

Convergence

elbo_converged = aggregate(converged~n_traits + method + L, res.mix, mean)
elbo_converged = elbo_converged[which(elbo_converged$L!=1),]
elbo_converged = elbo_converged[order(elbo_converged$n_traits),]
rownames(elbo_converged) = NULL
knitr::kable(elbo_converged) %>% kable_styling(full_width = F) %>%
  row_spec(c(1:4), background = "wheat")
n_traits method L converged
5 mnm_mixture01 2 0.9700000
5 mnm_rss_mixture01 2 0.9866667
5 mnm_mixture01 10 0.7600000
5 mnm_rss_mixture01 10 0.7700000
10 mnm_mixture01 2 0.9833333
10 mnm_rss_mixture01 2 0.9700000
10 mnm_mixture01 10 0.7533333
10 mnm_rss_mixture01 10 0.7533333

sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)

Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] knitr_1.20       kableExtra_1.1.0 dplyr_0.8.0.1   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3        highr_0.7         pillar_1.4.3     
 [4] compiler_3.5.1    later_0.7.5       git2r_0.26.1     
 [7] workflowr_1.6.0   tools_3.5.1       digest_0.6.25    
[10] viridisLite_0.3.0 evaluate_0.12     tibble_2.1.3     
[13] lifecycle_0.1.0   pkgconfig_2.0.3   rlang_0.4.4      
[16] rstudioapi_0.10   yaml_2.2.0        stringr_1.4.0    
[19] httr_1.3.1        xml2_1.2.0        fs_1.3.1         
[22] vctrs_0.2.3       hms_0.5.3         webshot_0.5.1    
[25] rprojroot_1.3-2   tidyselect_0.2.5  glue_1.3.1       
[28] R6_2.4.1          rmarkdown_1.10    purrr_0.3.2      
[31] readr_1.3.1       magrittr_1.5      whisker_0.3-2    
[34] backports_1.1.5   scales_1.1.0      promises_1.0.1   
[37] htmltools_0.3.6   assertthat_0.2.1  rvest_0.3.2      
[40] colorspace_1.4-1  httpuv_1.4.5      stringi_1.4.3    
[43] munsell_0.5.0     crayon_1.3.4