-
Notifications
You must be signed in to change notification settings - Fork 6
/
tables-figures.Rmd
136 lines (82 loc) · 4.18 KB
/
tables-figures.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
---
title: "Code to reproduce tables and figures in _Simultaneous SNP selection and adjustment for population structure in high dimensional prediction models_. Bhatnagar et al. (2020). PLOS Genetics."
author: "by Sahir Bhatnagar"
date: "`r Sys.Date()`"
output:
html_document:
toc: true
toc_float: false
number_sections: true
toc_depth: 4
header-includes:
- \newcommand{\bx}{\textbf{\emph{x}}}
- \newcommand{\by}{\textbf{\emph{y}}}
- \newcommand{\bX}{\textbf{X}}
- \newcommand{\bW}{\textbf{W}}
- \newcommand{\bY}{\textbf{Y}}
- \newcommand{\bbeta}{\boldsymbol{\beta}}
editor_options:
chunk_output_type: console
---
This `.Rmd` file contains the code to reproduce the tables and figures in the paper _Simultaneous SNP selection and adjustment for population structure in high dimensional prediction models_. Bhatnagar et al. (2020). PLOS Genetics.
# How to compile this document
The easiest way to compile this document is to clone the https://github.com/sahirbhatnagar/ggmix repository or download the zip file https://github.com/sahirbhatnagar/ggmix/archive/master.zip. Open the file [`manuscript/bin/tables-figures.Rmd`](https://github.com/sahirbhatnagar/ggmix/blob/master/manuscript/bin/tables-figures.Rmd) in RStudio and click on the _Knit_ button. If you don't use RStudio, then from the `R` console enter `rmarkdown::render("manuscript/bin/tables-figures.Rmd")`. This assumes that you have installed both the `knitr` and `rmarkdown` packages, and are in the root of the `ggmix` folder.
The order in which the tables and figures appear follow that of the paper. The `R` scripts for each Table and Figure are in separate `R` files found in the [`manuscript/bin`](https://github.com/sahirbhatnagar/ggmix/tree/master/manuscript/bin) folder. This `.Rmd` document uses [code externalization](https://yihui.org/knitr/demo/externalization/).
# Load Requires Packages
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, warning = FALSE, message = FALSE)
options(digits = 4, scipen = 2)
knitr::read_chunk(here::here("manuscript/bin/setup.R"))
knitr::read_chunk(here::here("manuscript/bin/simulation.R"))
knitr::read_chunk(here::here("manuscript/bin/GAW20.R"))
knitr::read_chunk(here::here("manuscript/bin/UKB.R"))
knitr::read_chunk(here::here("manuscript/bin/mice.R"))
```
```{r packages}
```
```{r globals}
```
# Figure 1
```{r plot-kinship-sim}
```
# Figure 2
```{r plot-pc-sim}
```
# Table 1
The simulation study results were run on a cluster using the [simulator](https://cran.r-project.org/package=simulator) package. The simulator files can be found in the [`simulation`](https://github.com/sahirbhatnagar/ggmix/tree/master/simulation) folder:
- [`simulation/main.R`](https://raw.githubusercontent.com/sahirbhatnagar/ggmix/master/simulation/main.R) contains the main file which runs the simulation. This can be thought of as a master file which in turn calls the methods, model and eval functions
- [`simulation/model_functions.R`](https://raw.githubusercontent.com/sahirbhatnagar/ggmix/master/simulation/model_functions.R) contains the model functions, i.e., used to simulate the data
- [`simulation/method_functions.R`](https://raw.githubusercontent.com/sahirbhatnagar/ggmix/master/simulation/method_functions.R) contains the the individual methods which are applied on the simulated data
- [`simulation/eval_functions.R`](https://raw.githubusercontent.com/sahirbhatnagar/ggmix/master/simulation/eval_functions.R) contains the functions used to evaluate the different methods
```{r simulation-results}
```
```{r table-of-results}
```
```{r print-sim-table, results='asis'}
```
# Figure 3
```{r UKB-Figure,fig.width=8, fig.height=7}
```
# Table 2
```{r GAW20-prediction-RMSE-activeVariable}
```
# Figure 4
```{r Mice-comparison-fixTPR, fig.width=12, fig.height=10}
```
# S1 Figure
```{r UKB-chromosome-distribution}
```
# S2 Figure
```{r GAW20-R2}
```
# S3 Figure
```{r Mice-R2}
```
# File and Session Information
* File creation date: `r Sys.Date()`
* `r R.version.string`
* R version (short form): `r getRversion()`
* Additional session information
```{r echo=FALSE}
if (!requireNamespace("devtools")) sessionInfo() else devtools::session_info()
```