Reading

Everyone should read:

Optional reading:


Markdown

Markdown is a plain text formatting language designed to create html documents using plain text and indentation to specify the desired format while remaining easy to read in its raw format. Thanks to the magic of Pandoc Markdown can also be used to create PDF, MS Word, and other types of documents.

There are many “flavors” of markdown, but they all implement the core idea of using simple plain text formats to specify the desired markup. For this course the two most relevant markdown “flavors” are Github flavored markdown and Rmarkdown.


Rmarkdown

This document was written in Rmarkdown using RStudio. You can see the source at Stats506_F20.

You will use Rmarkdown for all assignments in the course. To begin, you should familiarize yourself with the basic formatting options specified under “Examples” from Github flavored markdown.

In addition, you should learn to:

  1. Knit your R markdown documents using a shortcut key, i.e.  cmd+shift+enter or ctrl+shift+enter

  2. Knit programmatically using rmarkdown::render().

  3. Include plots and tables (knitr::kable()) in your documents.

Templates for problem sets are available at Stats506_F20.


LaTex

You can include math in your Rmarkdown documents using LaTex. LaTex is a typesetting program and markup language popular for writing scientific articles, especially within the mathematical sciences. If you’ve never used LaTex before, here are the basics.

  1. Use math inline by enclosing it between dollar signs. For instance, $Y|X \sim \mathrm{N(X\beta, \sigma^2I_{n,n})}$ becomes \(Y|X \sim \mathrm{N(X\beta, \sigma^2I_{n,n})}\).

  2. Use escaped commands for special symbols, e.g. Greek letters \Sigma for \(\Sigma\).

  3. Create equation displays using a math mode environment \[ \], e.g.

\[
 \begin{align}
 {n \choose k} &= \frac{n!}{(n-k)!k!} \\
               &= \frac{\prod_{i=1}^n i}{ \left(\prod_{i=1}^{n-k} i \right)
                                          \left(\prod_{j=1}^k j \right) } \\
               &= \frac{ \prod_{i=(n-k+1)}^n i}{\prod_{j=1}^k j} \\
               &= \frac{ (n-k+1) \times \dots \times n}{2 \times \dots k}
 \end{align}
\]

becomes \[ \begin{align} {n \choose k} &= \frac{n!}{(n-k)!k!} \\ &= \frac{\prod_{i=1}^n i}{ \left(\prod_{i=1}^{n-k} i \right) \left(\prod_{j=1}^k j \right) } \\ &= \frac{ \prod_{i=(n-k+1)}^n i}{\prod_{j=1}^k j} \\ &= \frac{ (n-k+1) \times \dots \times n} {2 \times \dots \times k} \end{align} \]

Those new to LaTex may also find the section Math in Rmarkdown of Cosma Shalizi’s Rmarkdown notes helpful.

For a comprehensive list of symbols available in LaTex and their escaped commands refer to: http://tug.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

You also must have a LaTex distribution available for Pandoc to turn your markdown into a pdf document:
.Rmd \(\rightarrow_{\mathrm{knitr}}\) .md \(\rightarrow_{\mathrm{pandoc}}\) .tex \(\rightarrow_{\mathrm{LaTex}}\) .pdf.

Style Notes

When using Rmarkdown for problem sets: