1
0
Fork 0
mirror of https://github.com/eddelbuettel/binb synced 2025-07-04 12:26:47 +02:00

updated vignettes, skeleton and manual page

This commit is contained in:
Dirk Eddelbuettel 2018-09-18 20:22:22 -05:00
parent 2cff356a9f
commit 0134a90819
17 changed files with 771 additions and 161 deletions

View file

@ -1,8 +1,8 @@
---
author: Gary King and Ista Zahn
author: Ista Zahn and Gary King
classoption: compress
fontsize: 12pt
title: Beamer Class Demonstration
title: IQSS Beamer Class Demonstration
date: \today
institute: IQSS
output: binb::iqss
@ -15,9 +15,6 @@ output: binb::iqss
### What's this course about?
::: incremental
- \alert{Specific statistical methods for many research problems}
- How to learn (or create) new methods
- Inference: \underline{Using facts you know to learn about
@ -33,8 +30,6 @@ output: binb::iqss
- We will go as fast as possible subject to everyone following along
- We cover different amounts of material each week
:::
### How much math will you scare us with?
- All math requires two parts: \alertb{proof} and \alertb{concepts \& intuition}
@ -49,9 +44,6 @@ output: binb::iqss
- Includes ``how to'' computation
- $\leadsto$ Fewer proofs, more concepts, better practical knowledge
- Do you have the background for this class?
. . .
\alert{A Test: What's this?
\begin{align*}
b=(X'X)^{-1}X'y
@ -74,53 +66,6 @@ output: binb::iqss
with different meaning
### Negative Binomial Derivation
\uncover<+->{Recall:}
\begin{equation*}
\uncover<+->{\Pr(A|B)=\frac{\Pr(AB)}{\Pr(B)} \implies
\alertb{\Pr(AB)}=\alerte{\Pr(A|B)}\alertd{\Pr(B)}}
\end{equation*}
\alertb<1-1>{one}
\alertc<2-2>{two}
\alertd<3-3>{three}
\begin{align*}
\uncover<+->{\text{NegBin}(y|\phi,\sigma^2) &= \int_0^\infty
\alerte{\text{Poisson}(y|\lambda)}
\times\alertd{\text{gamma}(\lambda|\phi,\sigma^2)}d\lambda\\}
\uncover<+->{&= \int_0^\infty
\alertb{\P(y,\lambda|\phi,\sigma^2) }d\lambda\\}
\uncover<+->{&=
\frac{\Gamma\left(\frac{\phi}{\sigma^2-1}+y_i\right)}
{y_i!\Gamma\left(\frac{\phi}{\sigma^2-1}\right)}
\left(\frac{\sigma^2-1}{\sigma^2}\right)^{y_i}
\left(\sigma^2\right)^{\frac{-\phi}{\sigma^2-1}}}
\end{align*}
# Other Features
## Structural Features
### Structural Features
#### Levels of Structure
- usual \LaTeX\ \textbackslash\ section, \textbackslash\ subsection commands
- `frame` environments provide slides
- `block` environments divide slides into logical sections
- `columns` environments divide slides vertically (example later)
- overlays (\`a la prosper) change content of slides dynamically
#### \alertc{Overlay Alerts}
On the first overlay, \alert<1>{this text} is highlighted (or \emph{alerted}).
On the second, \alert<2>{this text} is.
### Code blocks
\footnotesize
@ -130,23 +75,17 @@ On the second, \alert<2>{this text} is.
hello <- function(name) paste("hello", name)
```
. . .
```python
# Say hello in Python
def hello(name):
return("Hello" + " " + name)
```
. . .
```haskell
-- Say hello in Haskell
hello name = "Hello" ++ " " ++ name
```
. . .
```c
/* Say hello in C */
#include <stdio.h>
@ -157,7 +96,6 @@ int main()
printf("Hello %s", name);
return(0);
}
```
\normalsize
@ -187,7 +125,7 @@ int main()
- pgf graphics framework easy to use
- include external JPEG/PNG/PDF figures
- output directly to pdf: no PostScript hurdles
- detailed User's Manual (with good presentation advice, too)
- detailed User Manual (with good presentation advice, too)
### Theorems and Proofs
@ -215,29 +153,51 @@ $2=2$.
#### \alertc{Example block}
The set $\{1,2,3,5\}$ has four elements.
# RMarkdown Examples
# Appendix
### R Figure
---
The following code generates the plot on the next slide (taken from
`help(bxp)` and modified slightly):
Backup Slides
```{r pressureCode, eval=FALSE}
library(stats)
set.seed(753)
bx.p <- boxplot(split(rt(100, 4),
gl(5, 20)), plot=FALSE)
bxp(bx.p, notch = FALSE, boxfill = "lightblue",
frame = FALSE, outl = TRUE,
main = "Example from help(bxp)")
```
<!-- \subsection{More stuff} -->
---
### R Figure
```{r pressureFig, echo=FALSE}
library(stats)
set.seed(753)
bx.p <- boxplot(split(rt(100, 4),
gl(5, 20)), plot=FALSE)
bxp(bx.p, notch = FALSE, boxfill = "lightblue",
frame = FALSE, outl = TRUE,
main = "Example from help(bxp)")
```
Details
### R Table
A simple `knitr::kable` example:
---
\small
Text omitted in main talk.
```{r kableEx}
knitr::kable(mtcars[1:5, 1:8],
caption="(Parts of) the mtcars dataset")
```
<!-- \subsection{Even more additional material} -->
### Resources
---
More details
---
Even more details
#### For more information:
- See the [IQSS repository](https://github.com/IQSS/iqss-beamer-theme) for more on the IQSS them
- See the [RMarkdown repository](https://github.com/rstudio/rmarkdown) for more on RMarkdown
- See the [binb repository](https://github.com/eddelbuettel/binb) for more on binb
- See the [binb vignettes](https://github.com/eddelbuettel/binb/vignettes) for more examples.

View file

@ -1,99 +1,102 @@
---
author: Your Name Here and Some Other Person
title: "Something really clever here: \\newline And maybe a second line"
subtitle: You can also have a subtitle
date: 2018-09-15
title: A minimal example
subtitle: With a subtitle
author: Matthias Vogelgesang
date: \today
institute: Centre for Modern Beamer Themes
output: binb::metropolis
fontsize: 12pt
---
```{r,setup, include=FALSE}
knitr::opts_chunk$set(cache=TRUE)
```
# A Section Header
# First Section
## A Slide Header
## First Frame
### A Subtitle
Hello, world!
- Point A
- Point B
- Point C
# Second Section
# Principal Resources
## Second Frame
## Metropolis
### Bulleted Lists
- Element A
- Element B
- B.1
- B.2
- Element C
### Main Repos
# Elements
- [Official GitHub Repo of Metropolis](https://github.com/matze/mtheme)
(formerly mtheme); older version in TeXLive
- [My GitHub Repo for a local Ubuntu package of Metropolis](https://github.com/eddelbuettel/pkg-latex-metropolis) -- formerly mtheme
- [My GitHub Repo for a local Ubuntu package for the Fira font](https://github.com/eddelbuettel/pkg-fonts-fira)
## Typography
## Ubuntu and Launchpad
```
The theme provides sensible defaults to
\emph{emphasize} text, \alert{accent} parts
or show \textbf{bold} results.
### Briefly
In Markdown, you can also use _emphasize_ and **bold**.
```
- The packages which can be built (ie not Fira as it needs external fonts
which we cannot download during build) are
[in this repo](https://launchpad.net/~edd/+archive/ubuntu/misc/+packages)
- If you're not on Ubuntu, it is probably more work to get
- Metropolis into your \LaTeX environment
- the Fira font into your \LaTeX environment
- I *did* try without (on plain Ubuntu 16.04) and it _builds_ but looks less
crisp
- So for the time being you probably want these fresh from source, or via my
helpers. YMMV.
\begin{center}becomes\end{center}
## Local Adaption
The theme provides sensible defaults to \emph{emphasize} text,
\alert{accent} parts or show \textbf{bold} results.
- mtheme and metropolis changed a bit since I first used them
- I started with a local modification I called m2; the package is still in
the launchpad repo
- I generally include a file `header.tex` from the YAML for color, font,
... tweaking at the \LaTeX level, but as these are presentation-specific I
didn't include any changes here.
_ _ _
\LARGE Breakout page
## Using LaTeX Parts: Equations
### Linear Model
$$ \hat{\beta} = \text{argmin}_{b \in \mathbb{R}} S(b) = \left( \frac{1}{n} \sum_{i=1}^n x_i x_i^T \right)^{-1} \cdot \frac{1}{n} \sum_{i=1}^n x_i y_i $$
or in matrix form
$$ \hat{\beta} = (X^TX)^{-1} X^T y $$
In Markdown, you can also use _emphasize_ and **bold**.
## Using LaTeX Parts: Blocks
## Math
As one example of falling back into \LaTeX, consider the example of
three different block environments are pre-defined and may be styled
with an optional background color.
\begin{equation*}
e = \lim_{n\to \infty} \left(1 + \frac{1}{n}\right)^n
\end{equation*}
<!-- this sets the background -->
\metroset{block=fill}
\begin{block}{Default}
Block content.
\end{block}
## R Figure Example
\begin{alertblock}{Alert}
Block content.
\end{alertblock}
The following code generates the plot on the next slide (taken from
`help(bxp)` and modified slightly):
\begin{exampleblock}{Example}
Block content.
\end{exampleblock}
```{r pressureCode, eval=FALSE}
library(stats)
set.seed(753)
bx.p <- boxplot(split(rt(100, 4),
gl(5, 20)), plot=FALSE)
bxp(bx.p, notch = FALSE, boxfill = "lightblue",
frame = FALSE, outl = TRUE,
main = "Example from help(bxp)")
```
## Finally
### Going Forward
## R Figure Example
```{r pressureFig, echo=FALSE}
library(stats)
set.seed(753)
bx.p <- boxplot(split(rt(100, 4),
gl(5, 20)), plot=FALSE)
bxp(bx.p, notch = FALSE, boxfill = "lightblue",
frame = FALSE, outl = TRUE,
main = "Example from help(bxp)")
```
- Questions etc: Open issue tickets [at the GitHub repo](https://github.com/eddelbuettel/samples-rmarkdown-metropolis/issues)
- Pull requests welcome for bug fixes, extensions, examples, ...
## R Table Example
A simple `knitr::kable` example:
```{r kableEx}
knitr::kable(mtcars[1:5, 1:8],
caption="(Parts of) the mtcars dataset")
```
## Resources
### For more information:
- See the [Metropolis repository](https://github.com/matze/mtheme) for more on Metropolis
- See the [RMarkdown repository](https://github.com/rstudio/rmarkdown) for more on RMarkdown
- See the [binb repository](https://github.com/eddelbuettel/binb) for more on binb
- See the [binb vignettes](https://github.com/eddelbuettel/binb/vignettes) for more examples.