|
| 1 | +--- |
| 2 | +title: "Comparing gemma2 output with that of Zhou's GEMMA (v0.96)" |
| 3 | +author: "Frederick Boehm" |
| 4 | +date: "`r lubridate::now()`" |
| 5 | +output: rmarkdown::html_vignette |
| 6 | +vignette: > |
| 7 | + %\VignetteIndexEntry{Vignette Title} |
| 8 | + %\VignetteEngine{knitr::rmarkdown} |
| 9 | + %\VignetteEncoding{UTF-8} |
| 10 | +bibliography: gemma.bib |
| 11 | +--- |
| 12 | + |
| 13 | +```{r setup, include = FALSE} |
| 14 | +knitr::opts_chunk$set( |
| 15 | + collapse = TRUE, |
| 16 | + comment = "#>" |
| 17 | +) |
| 18 | +``` |
| 19 | + |
| 20 | +# Overview |
| 21 | + |
| 22 | +`gemma2` is an R implementation of an EM algorithm [@zhou2014efficient] to fit a multivariate linear mixed effects model. Specifically, it fits, via restricted maximum likelihood (REML), the model: |
| 23 | + |
| 24 | +$$vec(Y) = X vec(B) + vec(G) + vec(E)$$ |
| 25 | + |
| 26 | +where $Y$ is a n by 2 phenotypes matrix, with each row being a single subject and each column a distinct phenotype. $X$ is a 2n by 2f matrix of genotypes, where $n$ is the sample size and $f$ is the number of founder lines. $X$ has a block-diagonal structure, so that it contains, on the diagonal, two $n$ by $f$ blocks of genotype data. The two off-diagonal blocks are all zeros. $B$ is a $f$ by $2$ matrix of founder allele effect sizes. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +Vignettes are long form documentation commonly included in packages. Because they are part of the distribution of the package, they need to be as compact as possible. The `html_vignette` output type provides a custom style sheet (and tweaks some options) to ensure that the resulting html is as small as possible. The `html_vignette` format: |
| 32 | + |
| 33 | +- Never uses retina figures |
| 34 | +- Has a smaller default figure size |
| 35 | +- Uses a custom CSS stylesheet instead of the default Twitter Bootstrap style |
| 36 | + |
| 37 | +## Vignette Info |
| 38 | + |
| 39 | +Note the various macros within the `vignette` section of the metadata block above. These are required in order to instruct R how to build the vignette. Note that you should change the `title` field and the `\VignetteIndexEntry` to match the title of your vignette. |
| 40 | + |
| 41 | +## Styles |
| 42 | + |
| 43 | +The `html_vignette` template includes a basic CSS theme. To override this theme you can specify your own CSS in the document metadata as follows: |
| 44 | + |
| 45 | + output: |
| 46 | + rmarkdown::html_vignette: |
| 47 | + css: mystyles.css |
| 48 | + |
| 49 | +## Figures |
| 50 | + |
| 51 | +The figure sizes have been customised so that you can easily put two images side-by-side. |
| 52 | + |
| 53 | +```{r, fig.show='hold'} |
| 54 | +plot(1:10) |
| 55 | +plot(10:1) |
| 56 | +``` |
| 57 | + |
| 58 | +You can enable figure captions by `fig_caption: yes` in YAML: |
| 59 | + |
| 60 | + output: |
| 61 | + rmarkdown::html_vignette: |
| 62 | + fig_caption: yes |
| 63 | + |
| 64 | +Then you can use the chunk option `fig.cap = "Your figure caption."` in **knitr**. |
| 65 | + |
| 66 | +## More Examples |
| 67 | + |
| 68 | +You can write math expressions, e.g. $Y = X\beta + \epsilon$, footnotes^[A footnote here.], and tables, e.g. using `knitr::kable()`. |
| 69 | + |
| 70 | +```{r, echo=FALSE, results='asis'} |
| 71 | +knitr::kable(head(mtcars, 10)) |
| 72 | +``` |
| 73 | + |
| 74 | +Also a quote using `>`: |
| 75 | + |
| 76 | +> "He who gives up [code] safety for [code] speed deserves neither." |
| 77 | +([via](https://twitter.com/hadleywickham/status/504368538874703872)) |
0 commit comments