<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="generator" content="pandoc" /> <title>MASH v FLASH workflows for GTEx</title> <script src="site_libs/jquery-1.11.3/jquery.min.js"></script> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link href="site_libs/bootstrap-3.3.5/css/cosmo.min.css" rel="stylesheet" /> <script src="site_libs/bootstrap-3.3.5/js/bootstrap.min.js"></script> <script src="site_libs/bootstrap-3.3.5/shim/html5shiv.min.js"></script> <script src="site_libs/bootstrap-3.3.5/shim/respond.min.js"></script> <script src="site_libs/jqueryui-1.11.4/jquery-ui.min.js"></script> <link href="site_libs/tocify-1.9.1/jquery.tocify.css" rel="stylesheet" /> <script src="site_libs/tocify-1.9.1/jquery.tocify.js"></script> <script src="site_libs/navigation-1.1/tabsets.js"></script> <script src="site_libs/navigation-1.1/codefolding.js"></script> <link href="site_libs/highlightjs-9.12.0/textmate.css" rel="stylesheet" /> <script src="site_libs/highlightjs-9.12.0/highlight.js"></script> <link href="site_libs/font-awesome-4.5.0/css/font-awesome.min.css" rel="stylesheet" /> <style type="text/css">code{white-space: pre;}</style> <style type="text/css"> pre:not([class]) { background-color: white; } </style> <script type="text/javascript"> if (window.hljs) { hljs.configure({languages: []}); hljs.initHighlightingOnLoad(); if (document.readyState && document.readyState === "complete") { window.setTimeout(function() { hljs.initHighlighting(); }, 0); } } </script> <style type="text/css"> h1 { font-size: 34px; } h1.title { font-size: 38px; } h2 { font-size: 30px; } h3 { font-size: 24px; } h4 { font-size: 18px; } h5 { font-size: 16px; } h6 { font-size: 12px; } .table th:not([align]) { text-align: left; } </style> </head> <body> <style type = "text/css"> .main-container { max-width: 940px; margin-left: auto; margin-right: auto; } code { color: inherit; background-color: rgba(0, 0, 0, 0.04); } img { max-width:100%; height: auto; } .tabbed-pane { padding-top: 12px; } button.code-folding-btn:focus { outline: none; } </style> <style type="text/css"> /* padding for bootstrap navbar */ body { padding-top: 51px; padding-bottom: 40px; } /* offset scroll position for anchor links (for fixed navbar) */ .section h1 { padding-top: 56px; margin-top: -56px; } .section h2 { padding-top: 56px; margin-top: -56px; } .section h3 { padding-top: 56px; margin-top: -56px; } .section h4 { padding-top: 56px; margin-top: -56px; } .section h5 { padding-top: 56px; margin-top: -56px; } .section h6 { padding-top: 56px; margin-top: -56px; } </style> <script> // manage active state of menu based on current page $(document).ready(function () { // active menu anchor href = window.location.pathname href = href.substr(href.lastIndexOf('/') + 1) if (href === "") href = "index.html"; var menuAnchor = $('a[href="' + href + '"]'); // mark it active menuAnchor.parent().addClass('active'); // if it's got a parent navbar menu mark it active as well menuAnchor.closest('li.dropdown').addClass('active'); }); </script> <div class="container-fluid main-container"> <!-- tabsets --> <script> $(document).ready(function () { window.buildTabsets("TOC"); }); </script> <!-- code folding --> <style type="text/css"> .code-folding-btn { margin-bottom: 4px; } </style> <script> $(document).ready(function () { window.initializeCodeFolding("hide" === "show"); }); </script> <script> $(document).ready(function () { // move toc-ignore selectors from section div to header $('div.section.toc-ignore') .removeClass('toc-ignore') .children('h1,h2,h3,h4,h5').addClass('toc-ignore'); // establish options var options = { selectors: "h1,h2,h3", theme: "bootstrap3", context: '.toc-content', hashGenerator: function (text) { return text.replace(/[.\\/?&!#<>]/g, '').replace(/\s/g, '_').toLowerCase(); }, ignoreSelector: ".toc-ignore", scrollTo: 0 }; options.showAndHide = true; options.smoothScroll = true; // tocify var toc = $("#TOC").tocify(options).data("toc-tocify"); }); </script> <style type="text/css"> #TOC { margin: 25px 0px 20px 0px; } @media (max-width: 768px) { #TOC { position: relative; width: 100%; } } .toc-content { padding-left: 30px; padding-right: 40px; } div.main-container { max-width: 1200px; } div.tocify { width: 20%; max-width: 260px; max-height: 85%; } @media (min-width: 768px) and (max-width: 991px) { div.tocify { width: 25%; } } @media (max-width: 767px) { div.tocify { width: 100%; max-width: none; } } .tocify ul, .tocify li { line-height: 20px; } .tocify-subheader .tocify-item { font-size: 0.90em; padding-left: 25px; text-indent: 0; } .tocify .list-group-item { border-radius: 0px; } </style> <!-- setup 3col/9col grid for toc_float and main content --> <div class="row-fluid"> <div class="col-xs-12 col-sm-4 col-md-3"> <div id="TOC" class="tocify"> </div> </div> <div class="toc-content col-xs-12 col-sm-8 col-md-9"> <div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="index.html">MASHvFLASH</a> </div> <div id="navbar" class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li> <a href="index.html">Home</a> </li> <li> <a href="about.html">About</a> </li> </ul> <ul class="nav navbar-nav navbar-right"> <li> <a href="https://github.com/willwerscheid/MASHvFLASH"> <span class="fa fa-github"></span> </a> </li> </ul> </div><!--/.nav-collapse --> </div><!--/.container --> </div><!--/.navbar --> <!-- Add a small amount of space between sections. --> <style type="text/css"> div.section { padding-top: 12px; } </style> <div class="fluid-row" id="header"> <div class="btn-group pull-right"> <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span>Code</span> <span class="caret"></span></button> <ul class="dropdown-menu" style="min-width: 50px;"> <li><a id="rmd-show-all-code" href="#">Show All Code</a></li> <li><a id="rmd-hide-all-code" href="#">Hide All Code</a></li> </ul> </div> <h1 class="title toc-ignore">MASH v FLASH workflows for GTEx</h1> </div> <p><strong>Last updated:</strong> 2018-08-05</p> <strong>workflowr checks:</strong> <small>(Click a bullet for more information)</small> <ul> <li> <p><details> <summary> <strong style="color:blue;">✔</strong> <strong>R Markdown file:</strong> up-to-date </summary></p> <p>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.</p> </details> </li> <li> <p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Environment:</strong> empty </summary></p> <p>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.</p> </details> </li> <li> <p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Seed:</strong> <code>set.seed(20180609)</code> </summary></p> <p>The command <code>set.seed(20180609)</code> 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.</p> </details> </li> <li> <p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Session information:</strong> recorded </summary></p> <p>Great job! Recording the operating system, R version, and package versions is critical for reproducibility.</p> </details> </li> <li> <p><details> <summary> <strong style="color:blue;">✔</strong> <strong>Repository version:</strong> <a href="https://github.com/willwerscheid/MASHvFLASH/tree/20c64ab8dd494594811fe93e946176c2e598211f" target="_blank">20c64ab</a> </summary></p> 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. <br><br> 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 <code>wflow_publish</code> or <code>wflow_git_commit</code>). 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: <pre><code> Ignored files: Ignored: .DS_Store Ignored: .Rhistory Ignored: .Rproj.user/ Ignored: data/ Ignored: docs/.DS_Store Ignored: docs/images/.DS_Store Ignored: docs/images/.Rapp.history Ignored: output/.DS_Store Ignored: output/.Rapp.history Ignored: output/MASHvFLASHgtex/.DS_Store Ignored: output/MASHvFLASHsims/.DS_Store Ignored: output/MASHvFLASHsims/backfit/.DS_Store Ignored: output/MASHvFLASHsims/backfit/.Rapp.history </code></pre> 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. </details> </li> </ul> <details> <summary> <small><strong>Expand here to see past versions:</strong></small> </summary> <ul> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> File </th> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> <th style="text-align:left;"> Message </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/20c64ab8dd494594811fe93e946176c2e598211f/analysis/MASHvFLASHgtex2.Rmd" target="_blank">20c64ab</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-05 </td> <td style="text-align:left;"> wflow_publish(“analysis/MASHvFLASHgtex2.Rmd”) </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/MASHvFLASHgtex2.html" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/942570ee0ee19c9c19d91fd051ad78721f29a4f8/analysis/MASHvFLASHgtex2.Rmd" target="_blank">942570e</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> <td style="text-align:left;"> wflow_publish(“analysis/MASHvFLASHgtex2.Rmd”) </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/44d612af23122f685c3b54d242513a555cb4442f/docs/MASHvFLASHgtex2.html" target="_blank">44d612a</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/eaefa1508b5edbbb387d2b73265f7184193104b5/analysis/MASHvFLASHgtex2.Rmd" target="_blank">eaefa15</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> <td style="text-align:left;"> wflow_publish(“analysis/MASHvFLASHgtex2.Rmd”) </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/MASHvFLASHgtex2.html" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/36e6d622157c8912afbfdea4d54a6820e731d89d/analysis/MASHvFLASHgtex2.Rmd" target="_blank">36e6d62</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> <td style="text-align:left;"> wflow_publish(“analysis/MASHvFLASHgtex2.Rmd”) </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/76619eaf79fd50cd533381a42e934bd1fa481274/docs/MASHvFLASHgtex2.html" target="_blank">76619ea</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/30e7d2365049920928a8a1b14bb035ae97a6430e/analysis/MASHvFLASHgtex2.Rmd" target="_blank">30e7d23</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> <td style="text-align:left;"> wflow_publish(c(“analysis/index.Rmd”, </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/860aa52c7988a06c33df007c928bfce326e277fe/docs/MASHvFLASHgtex2.html" target="_blank">860aa52</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/3abd505e1c42acd32d1e7c9f8901f8f50efc9335/analysis/MASHvFLASHgtex2.Rmd" target="_blank">3abd505</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> <td style="text-align:left;"> wflow_publish(c(“analysis/MASHvFLASHsims.Rmd”, </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/8720e9c0eec4613a756a8113d69999cb1622cf7f/docs/MASHvFLASHgtex2.html" target="_blank">8720e9c</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-01 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/1874a0d6a3e899671c92b176fb197918b9102aa5/analysis/MASHvFLASHgtex2.Rmd" target="_blank">1874a0d</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-01 </td> <td style="text-align:left;"> wflow_publish(c(“analysis/MASHvFLASHgtex2.Rmd”, </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/ffbafca23fa62ff8737adb0c165979d76945a8b7/docs/MASHvFLASHgtex2.html" target="_blank">ffbafca</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-27 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/eb906037eb4f0f349b2a24277518fc83da3764e0/analysis/MASHvFLASHgtex2.Rmd" target="_blank">eb90603</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-27 </td> <td style="text-align:left;"> wflow_publish(“analysis/MASHvFLASHgtex2.Rmd”) </td> </tr> <tr> <td style="text-align:left;"> html </td> <td style="text-align:left;"> <a href="https://cdn.rawgit.com/willwerscheid/MASHvFLASH/89b9e6961fa70dbbe8556ee7ab38517bfcd1ae83/docs/MASHvFLASHgtex2.html" target="_blank">89b9e69</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> <td style="text-align:left;"> Build site. </td> </tr> <tr> <td style="text-align:left;"> Rmd </td> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/1ced9081bee45955fbe007db55f7c645f0394ddd/analysis/MASHvFLASHgtex2.Rmd" target="_blank">1ced908</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> <td style="text-align:left;"> wflow_publish(“analysis/MASHvFLASHgtex2.Rmd”) </td> </tr> </tbody> </table> </ul> <p></details></p> <hr /> <div id="introduction" class="section level2"> <h2>Introduction</h2> <p>While I previously compared MASH and FLASH fits on <a href="MASHvFLASHgtex.html">strong tests only</a> and on a <a href="MASHvFLASHrandom.html">random subset of tests</a>, here I propose several workflows that are analogous to the one suggested for the GTEx data in <a href="https://stephenslab.github.io/mashr/articles/eQTL_outline.html">this MASH vignette</a>. For the code used in this analysis, see <a href="#code">below</a>.</p> </div> <div id="fitting-methods" class="section level2"> <h2>Fitting Methods</h2> <p>For MASH, I follow the workflow in the vignette linked above, except that I assume that the null tests are uncorrelated (that is, I set <span class="math inline">\(V = I\)</span>). This is almost certainly not the case, but some more work needs to be done before we can handle the case <span class="math inline">\(V \ne I\)</span> in FLASH.</p> <p>The workflows for FLASH proceed along similar lines to the workflow for MASH:</p> <ol style="list-style-type: decimal"> <li><p>I obtain “data-driven” loadings (analogous to MASH’s data-driven covariance matrices) by fitting a FLASH object to the “strong” tests using either the “OHF” method or the “Zero” method described in my <a href="MASHvFLASHsims.html">simulation study</a>.</p></li> <li><p>I fix the loadings obtained in step 1 at their expectation <span class="math inline">\(EL\)</span> and add them as fixed data-driven loadings to a FLASH object. Further, I add 45 fixed “canonical” loadings (a vector of all ones and a one-hot vector for each of 44 conditions), which can be viewed as analogous to MASH’s canonical covariance matrices. (See the discussion in my <a href="intro.html">vignette</a>.) Since the “Zero” method generates many more data-driven loadings than the “OHF” method, I experiment with only keeping a subset of the data-driven loadings from the “Zero” method.</p></li> <li><p>With the loadings fixed, I backfit a FLASH object to the random subset of tests to obtain priors <span class="math inline">\(g_f\)</span> on the factors. I use the random subset rather than the “strong” subset because I want the priors to hold generally, and not just for the strong tests.</p></li> <li><p>Finally, using the same fixed loadings as in step 2 and fixing the priors <span class="math inline">\(g_f\)</span> at the values obtained in step 3, I backfit a FLASH object to the strong tests to get posterior means and variances.</p></li> </ol> <p>I fit five FLASH objects, using five variations of the above workflow:</p> <pre class="r"><code>methods <- data.frame(fit = as.character(1:5), data.driven = c("OHF", "Zero (top 5)", "Zero (top 10)", "Zero (top 20)", "Zero (full)"), include.canonical = c(rep("Yes", 4), "No")) knitr::kable(methods)</code></pre> <table> <thead> <tr class="header"> <th align="left">fit</th> <th align="left">data.driven</th> <th align="left">include.canonical</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left">1</td> <td align="left">OHF</td> <td align="left">Yes</td> </tr> <tr class="even"> <td align="left">2</td> <td align="left">Zero (top 5)</td> <td align="left">Yes</td> </tr> <tr class="odd"> <td align="left">3</td> <td align="left">Zero (top 10)</td> <td align="left">Yes</td> </tr> <tr class="even"> <td align="left">4</td> <td align="left">Zero (top 20)</td> <td align="left">Yes</td> </tr> <tr class="odd"> <td align="left">5</td> <td align="left">Zero (full)</td> <td align="left">No</td> </tr> </tbody> </table> </div> <div id="comments-on-mash-fit" class="section level2"> <h2>Comments on MASH fit</h2> <pre class="r"><code>library(mashr)</code></pre> <pre><code>Loading required package: ashr</code></pre> <pre class="r"><code>fpath <- "./output/MASHvFLASHgtex2/" m_final <- readRDS(paste0(fpath, "m.rds"))</code></pre> <p>It took 2.4 minutes to run Extreme Deconvolution to find data-driven covariance matrices. The MASH fit on the random subset of tests (to determine mixture weights) required 2.7 minutes, and the final MASH fit on the strong tests required only 16 seconds. The total fitting time was 5.3 minutes.</p> <p>The estimated mixture weights were as follows. Note in particular that there are large weights on the data-driven matrices “ED_tPCA” and “ED_PCA_2,” as well as on the canonical “equal_effects” matrix. There are moderate weights on the null matrix, some unique effects (including testis, thyroid, and transformed fibroblasts), and two of the canonical “simple_het” matrices (where effect sizes are assumed to be of equal variance and equally correlated, with correlation coefficients of, respectively, 0.25 and 0.5).</p> <pre class="r"><code>barplot(get_estimated_pi(m_final), las = 2, cex.names = 0.4)</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/mixwts-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of mixwts-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/mixwts-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/ffbafca23fa62ff8737adb0c165979d76945a8b7/docs/figure/MASHvFLASHgtex2.Rmd/mixwts-1.png" target="_blank">ffbafca</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-27 </td> </tr> </tbody> </table> <p></details></p> <p>Correlation plots for the data-driven matrices are as follows. The first (“ED_tPCA”) describes effects that are shared across a handful of tissues (which, notably, does not include brain tissues).</p> <pre class="r"><code>library(corrplot)</code></pre> <pre><code>corrplot 0.84 loaded</code></pre> <pre class="r"><code>corrplot(m_final$fitted_g$Ulist[["ED_tPCA"]], tl.cex=0.5)</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/corr-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of corr-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/corr-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/ffbafca23fa62ff8737adb0c165979d76945a8b7/docs/figure/MASHvFLASHgtex2.Rmd/corr-1.png" target="_blank">ffbafca</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-27 </td> </tr> </tbody> </table> <p></details></p> <p>The second (“ED_PCA_2”) describes a pattern of sharing among brain tissues that is, interestingly, strongly anti-correlated with whole blood.</p> <pre class="r"><code>corrplot(m_final$fitted_g$Ulist[["ED_PCA_2"]], tl.cex=0.5)</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/corr2-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of corr2-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/corr2-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/ffbafca23fa62ff8737adb0c165979d76945a8b7/docs/figure/MASHvFLASHgtex2.Rmd/corr2-1.png" target="_blank">ffbafca</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-27 </td> </tr> </tbody> </table> <p></details></p> </div> <div id="comments-on-flash-fits" class="section level2"> <h2>Comments on FLASH fits</h2> <pre class="r"><code>devtools::load_all("/Users/willwerscheid/GitHub/flashr/")</code></pre> <pre><code>Loading flashr</code></pre> <pre class="r"><code>fl_final <- list() fl_final[[1]] <- readRDS(paste0(fpath, "OHF.rds")) fl_final[[2]] <- readRDS(paste0(fpath, "top5.rds")) fl_final[[3]] <- readRDS(paste0(fpath, "top10.rds")) fl_final[[4]] <- readRDS(paste0(fpath, "top20.rds")) fl_final[[5]] <- readRDS(paste0(fpath, "zero.rds"))</code></pre> <div id="data-driven-loadings-step-1" class="section level3"> <h3>Data-driven loadings (step 1)</h3> <div id="ohf" class="section level4"> <h4>OHF</h4> <p>14.3 minutes were required to backfit the 45 canonical loadings and then greedily obtain 2 additional factor/loading pairs using the “OHF” method. The loadings thus obtained are plotted below. Clearly, they are not as “nice” (sparse, interpretable) as many of the factor/loading pairs obtained using the “Zero” method.</p> <p>To understand what’s happening, I want to pause to re-consider how the OHF method works. First, OHF backfits the canonical loadings. At this stage, the effect estimates have a simple interpretation: for each test, the effect in each condition is shrunken towards the mean effect (or rather, a shrunken estimate of the mean). This shrinkage is performed as if the deviations from the mean were independent. Second, data-driven loadings are greedily fitted to the residuals obtained from the backfit. These loadings will capture covariance structures that are more complex than the simple dependency structure captured by the canonical loadings (that is, dependence via the mean).</p> <p>I believe that the first data-driven loading (#46) is capturing two (or more) separate dependency structures. Clearly, it is capturing covariance among brain tissues. But notice also that the tissues that are negatively loaded are the same tissues that have large weights in the MASH “ED_tPCA” structure depicted above. Further, notice that the non-brain tissues that are positively loaded are anti-correlated with brain tissues according to the second data-driven loading (#47). Thus, a linear combination of #46 and #47 might yield a covariance structure that captures positive correlation among brain tissues alone (which is more or less what is described by the MASH “ED_PCA_2” structure illustrated above).</p> <p>In brief, I think that the dependencies implied by the OHF method are not so different from those implied by MASH as might at first appear. I think that this similarity could be further explored by placing non-negativity constraints on the loadings, which I intend to do in a future analysis.</p> <pre class="r"><code>missing.tissues <- c(7, 8, 19, 20, 24, 25, 31, 34, 37) gtex.colors <- read.table("https://github.com/stephenslab/gtexresults/blob/master/data/GTExColors.txt?raw=TRUE", sep = '\t', comment.char = '')[-missing.tissues, 2] par(mar=c(1,1,1,1)) par(mfrow=c(2,1)) for (i in 46:47) { barplot(fl_final[[1]]$EL[, i], main=paste('Loading', i), las=2, cex.names = 0.4, col=as.character(gtex.colors), names="") }</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/dd.OHF-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of dd.OHF-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/dd.OHF-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> </div> <div id="zero" class="section level4"> <h4>Zero</h4> <p>6.3 minutes were required to greedily add 37 factor/loading pairs using the “Zero” method. To view plots of the loadings, scroll down to the “FLASH loadings” section <a href="#flash_loadings">below</a>. Note in particular that most of the loadings beyond the first 16 or so are strongly loaded on a single condition. This observation motivated my desire to discard the majority of data-driven loadings. I reasoned that retaining only the “top” data-driven loadings would cut down on the time needed to backfit but would not change the final fit very much.</p> </div> </div> <div id="priors-on-factors-steps-2-3" class="section level3"> <h3>Priors on factors (steps 2-3)</h3> <p>The times needed to fit priors to the random subset of tests were as follows.</p> <pre class="r"><code>t <- readRDS(paste0(fpath, "t.rds")) t_random <- data.frame(fit = as.character(1:5), fixed.loadings = c("Canonical + OHF", "Canonical + Top 5 Zero", "Canonical + Top 10 Zero", "Canonical + Top 20 Zero", "Zero only"), number.of.factors = sapply(fl_final, function(x) {flash_get_nfactors(x)}), minutes.to.fit = sapply(t$random, function(x) {as.numeric(x, units="mins")}) ) knitr::kable(t_random, digits=1)</code></pre> <table> <thead> <tr class="header"> <th align="left">fit</th> <th align="left">fixed.loadings</th> <th align="right">number.of.factors</th> <th align="right">minutes.to.fit</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left">1</td> <td align="left">Canonical + OHF</td> <td align="right">47</td> <td align="right">3.0</td> </tr> <tr class="even"> <td align="left">2</td> <td align="left">Canonical + Top 5 Zero</td> <td align="right">50</td> <td align="right">8.5</td> </tr> <tr class="odd"> <td align="left">3</td> <td align="left">Canonical + Top 10 Zero</td> <td align="right">55</td> <td align="right">17.6</td> </tr> <tr class="even"> <td align="left">4</td> <td align="left">Canonical + Top 20 Zero</td> <td align="right">65</td> <td align="right">17.0</td> </tr> <tr class="odd"> <td align="left">5</td> <td align="left">Zero only</td> <td align="right">37</td> <td align="right">0.9</td> </tr> </tbody> </table> <p>To inspect the fitted priors <span class="math inline">\(g_f \sim (1 - w_f) \delta_0 + w_f N(0, \sigma^2_f)\)</span>, I plot the <span class="math inline">\(w_f\)</span>s (that is, the proportion of genes that we expect to have nonnull loadings for each factor/loading pair). The “equal effects” factor is colored black, while the “unique effects” factors are colored with the GTEx colors used in the factor plots above. The data-driven factors are colored brown (OHF) or in grayscale (Zero).</p> <pre class="r"><code>par(mfrow = c(1, 2)) plot_gf.w <- function(fl, names, colors, main) { w <- 1 - sapply(fl$gf, function(g) {g$pi0}) barplot(w, ylim=c(0, 1), ylab="w", xlab="factor/loading", cex.names=0.4, names=names, col=colors, main=main) } canonical.names <- c("EE", as.character(1:44)) canonical.colors <- c("black", as.character(gtex.colors)) OHF.colors <- c("tan4", "tan3") zero.colors <- c("black", gray.colors(19, 0.2, 0.9), gray.colors(17, 0.95, 1)) plot_gf.w(fl_final[[1]], c(canonical.names, paste0("D", 1:2)), c(canonical.colors, OHF.colors), main="Canonical + OHF") plot_gf.w(fl_final[[2]], c(canonical.names, paste0("D", 1:5)), c(canonical.colors, zero.colors[1:5]), main="Canonical + Top 5")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/plot_w-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of plot_w-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/plot_w-1.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/plot_w-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <pre class="r"><code>plot_gf.w(fl_final[[3]], c(canonical.names, paste0("D", 1:10)), c(canonical.colors, zero.colors[1:10]), main="Canonical + Top 10") plot_gf.w(fl_final[[4]], c(canonical.names, paste0("D", 1:20)), c(canonical.colors, zero.colors[1:20]), main="Canonical + Top 20")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/plot_w-2.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of plot_w-2.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/plot_w-2.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/plot_w-2.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <pre class="r"><code>plot_gf.w(fl_final[[5]], paste0("D", 1:37), zero.colors, main="Zero")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/plot_w-3.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of plot_w-3.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/plot_w-3.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/plot_w-3.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <p>It is also instructive to plot the <span class="math inline">\(\sigma_f\)</span>s, normalized so that the <span class="math inline">\(\ell_\infty\)</span>-norm for each loading is equal to one. These plots roughly describe how large we can expect non-null identical and unique effects to be. Note in particular that the “unique effects” loadings capture rare but large effects, whereas the data-driven loadings capture smaller but more common effects.</p> <pre class="r"><code>par(mfrow = c(1, 2)) plot_gf.s <- function(fl, names, colors, main) { nrm <- apply(abs(fl$EL), 2, max) s <- sqrt(1 / sapply(fl$gf, function(g) {g$a})) * nrm barplot(s, ylim=c(0, 6), ylab="sigma", xlab="factor/loading", cex.names=0.4, names=names, col=colors, main=main) } plot_gf.s(fl_final[[1]], c(canonical.names, paste0("D", 1:2)), c(canonical.colors, OHF.colors), main="Canonical + OHF") plot_gf.s(fl_final[[2]], c(canonical.names, paste0("D", 1:5)), c(canonical.colors, zero.colors[1:5]), main="Canonical + Top 5")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/plot_s-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of plot_s-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/plot_s-1.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/plot_s-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <pre class="r"><code>plot_gf.s(fl_final[[3]], c(canonical.names, paste0("D", 1:10)), c(canonical.colors, zero.colors[1:10]), main="Canonical + Top 10") plot_gf.s(fl_final[[4]], c(canonical.names, paste0("D", 1:20)), c(canonical.colors, zero.colors[1:20]), main="Canonical + Top 20")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/plot_s-2.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of plot_s-2.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/plot_s-2.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/plot_s-2.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <pre class="r"><code>plot_gf.s(fl_final[[5]], paste0("D", 1:37), zero.colors, main="Zero")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/plot_s-3.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of plot_s-3.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/plot_s-3.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> </tbody> </table> <p></details></p> </div> <div id="final-backfit-step-4" class="section level3"> <h3>Final backfit (step 4)</h3> <p>The times needed for the final backfits (with loadings and priors <span class="math inline">\(g_f\)</span> fixed at values determined during steps 1-3) were as follows.</p> <pre class="r"><code>t_final <- data.frame(fit = as.character(1:5), fixed.loadings = c("Canonical + OHF", "Canonical + Top 5 Zero", "Canonical + Top 10 Zero", "Canonical + Top 20 Zero", "Zero only"), number.of.factors = sapply(fl_final, function(x) {flash_get_nfactors(x)}), minutes.to.fit = sapply(t$final, function(x) {as.numeric(x, units="mins")}) ) knitr::kable(t_final, digits=1)</code></pre> <table> <thead> <tr class="header"> <th align="left">fit</th> <th align="left">fixed.loadings</th> <th align="right">number.of.factors</th> <th align="right">minutes.to.fit</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left">1</td> <td align="left">Canonical + OHF</td> <td align="right">47</td> <td align="right">4.9</td> </tr> <tr class="even"> <td align="left">2</td> <td align="left">Canonical + Top 5 Zero</td> <td align="right">50</td> <td align="right">14.4</td> </tr> <tr class="odd"> <td align="left">3</td> <td align="left">Canonical + Top 10 Zero</td> <td align="right">55</td> <td align="right">17.8</td> </tr> <tr class="even"> <td align="left">4</td> <td align="left">Canonical + Top 20 Zero</td> <td align="right">65</td> <td align="right">34.8</td> </tr> <tr class="odd"> <td align="left">5</td> <td align="left">Zero only</td> <td align="right">37</td> <td align="right">0.4</td> </tr> </tbody> </table> <p>The proportion of variance explained per factor/loading pair is as follows. Since, in each case, the “equal effects” factor/loading pair constitutes by far the largest proportion of variance explained (around 0.7), I only plot the PVE for the other factor/loading pairs.</p> <pre class="r"><code>par(mfrow = c(1, 2)) plot_pve <- function(fl, names, colors, main) { pve <- flash_get_pve(fl) barplot(pve[2:length(pve)], ylim=c(0, .05), ylab="PVE", xlab="factor/loading", cex.names=0.4, names=names, col=colors, main=main) } canonical.names <- as.character(1:44) canonical.colors <- canonical.colors[2:45] plot_pve(fl_final[[1]], c(canonical.names, paste0("D", 1:2)), c(canonical.colors, OHF.colors), main="Canonical + OHF") plot_pve(fl_final[[2]], c(canonical.names, paste0("D", 1:5)), c(canonical.colors, zero.colors[1:5]), main="Canonical + Top 5")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/pve-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of pve-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/pve-1.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/pve-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <pre class="r"><code>plot_pve(fl_final[[3]], c(canonical.names, paste0("D", 1:10)), c(canonical.colors, zero.colors[1:10]), main="Canonical + Top 10") plot_pve(fl_final[[4]], c(canonical.names, paste0("D", 1:20)), c(canonical.colors, zero.colors[1:20]), main="Canonical + Top 20")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/pve-2.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of pve-2.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/pve-2.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/pve-2.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> <pre class="r"><code>plot_pve(fl_final[[5]], paste0("D", 2:37), zero.colors[2:37], main="Zero")</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/pve-3.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of pve-3.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/c99babc9bcccffd7a6779fe5e8c5c52320609674/docs/figure/MASHvFLASHgtex2.Rmd/pve-3.png" target="_blank">c99babc</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-02 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/pve-3.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> </div> </div> <div id="total-fitting-time" class="section level2"> <h2>Total fitting time</h2> <p>The total time needed for each workflow is as follows.</p> <pre class="r"><code>fl_t <- (t_random$minutes.to.fit + t_final$minutes.to.fit + c(t$strong$OHF, t$strong$zero * c(5, 10, 20, 37) / 37)) total_time <- data.frame(method = c("OHF", "Top 5", "Top 10", "Top 20", "Zero", "MASH"), total.time.to.fit = c(fl_t, 5.3)) knitr::kable(total_time, digits=1)</code></pre> <table> <thead> <tr class="header"> <th align="left">method</th> <th align="left">total.time.to.fit</th> </tr> </thead> <tbody> <tr class="odd"> <td align="left">OHF</td> <td align="left">22.2 mins</td> </tr> <tr class="even"> <td align="left">Top 5</td> <td align="left">23.8 mins</td> </tr> <tr class="odd"> <td align="left">Top 10</td> <td align="left">37.1 mins</td> </tr> <tr class="even"> <td align="left">Top 20</td> <td align="left">55.2 mins</td> </tr> <tr class="odd"> <td align="left">Zero</td> <td align="left">7.5 mins</td> </tr> <tr class="even"> <td align="left">MASH</td> <td align="left">5.3 mins</td> </tr> </tbody> </table> </div> <div id="mash-v-flash-initial-observations" class="section level2"> <h2>MASH v FLASH initial observations</h2> <p>There is substantial disagreement among fits. The correlation matrix for posterior means is as follows.</p> <pre class="r"><code>all_fitted <- sapply(fl_final, flash_get_fitted_values) all_fitted <- cbind(all_fitted, as.vector(t(get_pm(m_final)))) colnames(all_fitted) <- c("OHF", "Top 5", "Top 10", "Top 20", "Zero", "MASH") round(cor(all_fitted), digits=3)</code></pre> <pre><code> OHF Top 5 Top 10 Top 20 Zero MASH OHF 1.000 0.984 0.983 0.983 0.971 0.966 Top 5 0.984 1.000 0.995 0.994 0.966 0.961 Top 10 0.983 0.995 1.000 0.999 0.968 0.963 Top 20 0.983 0.994 0.999 1.000 0.969 0.963 Zero 0.971 0.966 0.968 0.969 1.000 0.979 MASH 0.966 0.961 0.963 0.963 0.979 1.000</code></pre> <p>Entry <span class="math inline">\((i, j)\)</span> in the following matrix gives, of the values that method <span class="math inline">\(j\)</span> finds to be significant at 5%, the proportion of values that method <span class="math inline">\(i\)</span> also finds to be significant at 5%. For example, of the values that MASH finds to be significant, OHF also finds 90% to be significant. But of the values that OHF finds to be significant, MASH only agrees in 81% of cases.</p> <pre class="r"><code>fl_lfsr <- readRDS(paste0(fpath, "fllfsr.rds")) all_signif <- sapply(fl_lfsr, function(x) {as.numeric(x <= 0.05)}) all_signif <- cbind(all_signif, as.vector(t(get_lfsr(m_final) <= 0.05))) m <- ncol(all_signif) agree_mat <- matrix(0, nrow=m, ncol=m) for (i in 1:m) { for (j in 1:m) { agree_mat[i, j] <- (sum(all_signif[, i] * all_signif[, j]) / sum(all_signif[, j])) } } rownames(agree_mat) <- colnames(agree_mat) <- colnames(all_fitted) round(agree_mat, digits=2)</code></pre> <pre><code> OHF Top 5 Top 10 Top 20 Zero MASH OHF 1.00 0.93 0.92 0.92 0.90 0.90 Top 5 0.93 1.00 0.96 0.96 0.92 0.92 Top 10 0.92 0.96 1.00 0.98 0.93 0.92 Top 20 0.92 0.95 0.97 1.00 0.93 0.91 Zero 0.89 0.91 0.92 0.92 1.00 0.91 MASH 0.81 0.83 0.83 0.83 0.83 1.00</code></pre> <p>I will offer some explanations for the differences among fits in subsequent analyses.</p> </div> <div id="flash-loadings" class="section level2"> <h2>FLASH loadings</h2> <p>The FLASH loadings (as fitted on the strong tests) are as follows.</p> <pre class="r"><code>par(mar=c(1,1,1,1)) par(mfrow=c(3,2)) for(i in 1:flash_get_nfactors(fl_final[[5]])){ barplot(fl_final[[5]]$EL[, i], main=paste('Loading', i), las=2, cex.names = 0.4, col=as.character(gtex.colors), names="") }</code></pre> <p><img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-1.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-1.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-1.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/860aa52c7988a06c33df007c928bfce326e277fe/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-1.png" target="_blank">860aa52</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/89b9e6961fa70dbbe8556ee7ab38517bfcd1ae83/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-1.png" target="_blank">89b9e69</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> </tr> </tbody> </table> <p></details> <img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-2.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-2.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-2.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/860aa52c7988a06c33df007c928bfce326e277fe/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-2.png" target="_blank">860aa52</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/89b9e6961fa70dbbe8556ee7ab38517bfcd1ae83/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-2.png" target="_blank">89b9e69</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> </tr> </tbody> </table> <p></details> <img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-3.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-3.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-3.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/860aa52c7988a06c33df007c928bfce326e277fe/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-3.png" target="_blank">860aa52</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/89b9e6961fa70dbbe8556ee7ab38517bfcd1ae83/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-3.png" target="_blank">89b9e69</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> </tr> </tbody> </table> <p></details> <img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-4.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-4.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-4.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/860aa52c7988a06c33df007c928bfce326e277fe/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-4.png" target="_blank">860aa52</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/89b9e6961fa70dbbe8556ee7ab38517bfcd1ae83/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-4.png" target="_blank">89b9e69</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> </tr> </tbody> </table> <p></details> <img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-5.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-5.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-5.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/860aa52c7988a06c33df007c928bfce326e277fe/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-5.png" target="_blank">860aa52</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-07-22 </td> </tr> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/89b9e6961fa70dbbe8556ee7ab38517bfcd1ae83/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-5.png" target="_blank">89b9e69</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-06-26 </td> </tr> </tbody> </table> <p></details> <img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-6.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-6.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-6.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details> <img src="figure/MASHvFLASHgtex2.Rmd/flash_factors-7.png" width="672" style="display: block; margin: auto;" /></p> <details> <summary><em>Expand here to see past versions of flash_factors-7.png:</em></summary> <table style="border-collapse:separate; border-spacing:5px;"> <thead> <tr> <th style="text-align:left;"> Version </th> <th style="text-align:left;"> Author </th> <th style="text-align:left;"> Date </th> </tr> </thead> <tbody> <tr> <td style="text-align:left;"> <a href="https://github.com/willwerscheid/MASHvFLASH/blob/25e0a6f7be5d66fdc6a3ed5bee14751f7a309cd8/docs/figure/MASHvFLASHgtex2.Rmd/flash_factors-7.png" target="_blank">25e0a6f</a> </td> <td style="text-align:left;"> Jason Willwerscheid </td> <td style="text-align:left;"> 2018-08-01 </td> </tr> </tbody> </table> <p></details></p> </div> <div id="code" class="section level2"> <h2>Code</h2> <p>Click “Code” to view the code used to obtain the above results.</p> <pre class="r"><code># Make sure to use branch "trackObj" when loading flashr. # devtools::install_github("stephenslab/flashr", ref="trackObj") devtools::load_all("/Users/willwerscheid/GitHub/flashr/") # devtools::install_github("stephenslab/ebnm") devtools::load_all("/Users/willwerscheid/GitHub/ebnm/") library(mashr) source("./code/fits.R") source("./code/utils.R") fpath <- "./output/MASHvFLASHgtex2/" gtex <- readRDS(gzcon(url("https://github.com/stephenslab/gtexresults/blob/master/data/MatrixEQTLSumStats.Portable.Z.rds?raw=TRUE"))) strong <- t(gtex$strong.z) random <- t(gtex$random.z) # FLASH fits ------------------------------------------------------------ strong_data <- flash_set_data(strong, S = 1) random_data <- flash_set_data(random, S = 1) # methods to get DD: OHF; Zero(top5, top10, top20, full) # LLs to use: canonical + OHF; Zero; canonical + top5/top10/top15; full # Step 1. Learn data-driven loadings using strong tests. t0 <- Sys.time() fl_strong.OHF <- fit_flash_OHF(strong_data, Kmax=50, backfit=FALSE) t_strong.OHF <- Sys.time() - t0 t0 <- Sys.time() fl_strong.zero <- fit_flash_zero(strong_data, Kmax=50, backfit=FALSE) t_strong.zero <- Sys.time() - t0 # Step 2. Fit the model to random tests to learn priors on factors. LL <- list() LL[[1]] <- fl_strong.OHF$f$EL n <- nrow(strong) canonical <- cbind(rep(1, n), diag(rep(1, n))) LL[[2]] <- cbind(canonical, fl_strong.zero$f$EL[, 1:5]) LL[[3]] <- cbind(canonical, fl_strong.zero$f$EL[, 1:10]) LL[[4]] <- cbind(canonical, fl_strong.zero$f$EL[, 1:20]) LL[[5]] <- fl_strong.zero$f$EL fl_random <- list() t_random <- list() for (i in 1:length(LL)) { t0 <- Sys.time() fl <- flash_add_fixed_l(random_data, LL[[i]]) fl <- flash_backfit(random_data, fl, var_type="zero", ebnm_fn = "ebnm_pn", nullcheck = FALSE, warmstart = TRUE, verbose = TRUE) t_random[[i]] <- Sys.time() - t0 fl_random[[i]] <- fl$f } # Step 3. Compute posteriors on strong tests, using priors from step 2. fl_final <- list() t_final <- list() for (i in 1:length(LL)) { t0 <- Sys.time() fl <- flash_add_fixed_l(strong_data, LL[[i]]) ebnm_param_f = lapply(fl_random[[i]]$gf, function(g) {list(g=g, fixg=TRUE)}) fl <- flash_backfit(strong_data, fl, var_type="zero", ebnm_fn = "ebnm_pn", ebnm_param = list(f = ebnm_param_f, l = list()), nullcheck = FALSE, verbose = TRUE) t_final[[i]] <- Sys.time() - t0 fl_final[[i]] <- fl$f } saveRDS(fl_final[[1]], paste0(fpath, "OHF.rds")) saveRDS(fl_final[[2]], paste0(fpath, "top5.rds")) saveRDS(fl_final[[3]], paste0(fpath, "top10.rds")) saveRDS(fl_final[[4]], paste0(fpath, "top20.rds")) saveRDS(fl_final[[5]], paste0(fpath, "zero.rds")) t <- list() t$strong <- list() t$strong$OHF <- t_strong.OHF t$strong$zero <- t_strong.zero t$random <- t_random t$final <- t_final # Sample from posterior to get LFSR for FLASH fits ---------------------- nsamp <- 200 fl_lfsr <- list() for (i in 1:length(fl_final)) { sampler <- flash_sampler(strong_data, fl_final[[i]], fixed="loadings") samp <- sampler(200) fl_lfsr[[i]] <- flash_lfsr(samp) } saveRDS(fl_lfsr, paste0(fpath, "fllfsr.rds")) # MASH fit -------------------------------------------------------------- strong_data <- mash_set_data(t(strong), Shat = 1) random_data <- mash_set_data(t(random), Shat = 1) t$mash <- list() # Step 1. Learn data-driven loadings using strong tests. t0 <- Sys.time() U.pca <- cov_pca(strong_data, 5) U.ed <- cov_ed(strong_data, U.pca) t$mash$ed <- Sys.time() - t0 # 2. Fit the model to random tests to learn mixture weights t0 <- Sys.time() U.c <- cov_canonical(random_data) m_random <- mash(random_data, Ulist = c(U.ed,U.c)) t$mash$random <- Sys.time() - t0 # 3. Compute posterior summaries on the strong tests t0 <- Sys.time() m_final <- mash(strong_data, g=get_fitted_g(m_random), fixg=TRUE) t$mash$final <- Sys.time() - t0 saveRDS(m_final, paste0(fpath, "m.rds")) saveRDS(t, paste0(fpath, "t.rds"))</code></pre> </div> <div id="session-information" class="section level2"> <h2>Session information</h2> <pre class="r"><code>sessionInfo()</code></pre> <pre><code>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] flashr_0.5-13 corrplot_0.84 mashr_0.2-7 ashr_2.2-10 loaded via a namespace (and not attached): [1] Rcpp_0.12.17 pillar_1.2.1 compiler_3.4.3 [4] git2r_0.21.0 highr_0.6 plyr_1.8.4 [7] workflowr_1.0.1 R.methodsS3_1.7.1 R.utils_2.6.0 [10] iterators_1.0.9 tools_3.4.3 testthat_2.0.0 [13] digest_0.6.15 tibble_1.4.2 gtable_0.2.0 [16] evaluate_0.10.1 memoise_1.1.0 lattice_0.20-35 [19] rlang_0.2.0 Matrix_1.2-12 foreach_1.4.4 [22] commonmark_1.4 yaml_2.1.17 parallel_3.4.3 [25] ebnm_0.1-12 mvtnorm_1.0-7 xml2_1.2.0 [28] roxygen2_6.0.1.9000 withr_2.1.1.9000 stringr_1.3.0 [31] knitr_1.20 devtools_1.13.4 rprojroot_1.3-2 [34] grid_3.4.3 R6_2.2.2 rmarkdown_1.8 [37] rmeta_3.0 ggplot2_2.2.1 magrittr_1.5 [40] whisker_0.3-2 scales_0.5.0 backports_1.1.2 [43] codetools_0.2-15 htmltools_0.3.6 MASS_7.3-48 [46] assertthat_0.2.0 softImpute_1.4 colorspace_1.3-2 [49] stringi_1.1.6 lazyeval_0.2.1 munsell_0.4.3 [52] doParallel_1.0.11 pscl_1.5.2 truncnorm_1.0-8 [55] SQUAREM_2017.10-1 R.oo_1.21.0 </code></pre> </div> <!-- Adjust MathJax settings so that all math formulae are shown using TeX fonts only; see http://docs.mathjax.org/en/latest/configuration.html. This will make the presentation more consistent at the cost of the webpage sometimes taking slightly longer to load. Note that this only works because the footer is added to webpages before the MathJax javascript. --> <script type="text/x-mathjax-config"> MathJax.Hub.Config({ "HTML-CSS": { availableFonts: ["TeX"] } }); </script> <hr> <p> This reproducible <a href="http://rmarkdown.rstudio.com">R Markdown</a> analysis was created with <a href="https://github.com/jdblischak/workflowr">workflowr</a> 1.0.1 </p> <hr> </div> </div> </div> <script> // add bootstrap table styles to pandoc tables function bootstrapStylePandocTables() { $('tr.header').parent('thead').parent('table').addClass('table table-condensed'); } $(document).ready(function () { bootstrapStylePandocTables(); }); </script> <!-- dynamically load mathjax for compatibility with self-contained --> <script> (function () { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"; document.getElementsByTagName("head")[0].appendChild(script); })(); </script> </body> </html>