Skip to content

Commit b3d71a2

Browse files
authored
Merge pull request #129 from Yu-Group/vignette-mds
Re-add `simChef.Rmd` vignette example .md files
2 parents b5e328a + befc6a4 commit b3d71a2

File tree

11 files changed

+167
-91
lines changed

11 files changed

+167
-91
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
^renv$
2+
^renv\.lock$
13
^_pkgdown\.yml$
24
^docs$
35
^pkgdown$

.github/workflows/check-standard.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
# Workflow derived from https://github.com/r-lib/actions/blob/v2/examples/check-standard.yaml
1+
# Workflow derived from https://github.com/r-lib/actions/blob/v2.3.1/examples/check-standard.yaml
22
on:
33
push:
4-
branches: main
4+
branches: [main]
55
pull_request:
6-
branches: main
6+
branches: [main]
77

88
name: R-CMD-check
99

1010
jobs:
11-
# Check R build
1211
R-CMD-check:
1312
runs-on: ${{ matrix.config.os }}
1413

@@ -18,7 +17,7 @@ jobs:
1817
fail-fast: false
1918
matrix:
2019
config:
21-
- {os: macOS-latest, r: 'release'}
20+
- {os: macos-latest, r: 'release'}
2221
- {os: windows-latest, r: 'release'}
2322
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2423
- {os: ubuntu-latest, r: 'release'}
@@ -29,7 +28,7 @@ jobs:
2928
R_KEEP_PKG_SOURCE: yes
3029

3130
steps:
32-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v3
3332

3433
- uses: r-lib/actions/setup-pandoc@v2
3534

.github/workflows/pkgdown.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# Workflow derived from https://github.com/r-lib/actions/blob/v2/examples/pkgdown.yaml
1+
# Workflow derived from https://github.com/r-lib/actions/blob/v2.3.1/examples/pkgdown.yaml
22
on:
33
push:
4-
branches: main
4+
branches: [main]
55
pull_request:
6-
branches: main
6+
branches: [main]
77
release:
88
types: [published]
99
workflow_dispatch:
1010

1111
name: pkgdown
1212

1313
jobs:
14-
# Build website
14+
# Build docs website
1515
pkgdown:
1616
runs-on: ubuntu-latest
1717
# Only restrict concurrency for non-PR jobs
@@ -20,7 +20,7 @@ jobs:
2020
env:
2121
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
2222
steps:
23-
- uses: actions/checkout@v2
23+
- uses: actions/checkout@v3
2424

2525
- uses: r-lib/actions/setup-pandoc@v2
2626

@@ -44,7 +44,7 @@ jobs:
4444

4545
- name: Deploy to GitHub pages 🚀
4646
if: github.event_name != 'pull_request'
47-
uses: JamesIves/[email protected].4
47+
uses: JamesIves/github-pages-deploy-action@v4.4.1
4848
with:
4949
clean: false
5050
branch: gh-pages

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ results/
1313

1414
## ---- R
1515

16+
# renv
17+
18+
renv/
19+
.Rprofile
20+
renv.lock
21+
1622
# R project files
1723
*.Rproj
1824

@@ -58,7 +64,7 @@ vignettes/*.pdf
5864
.Renviron
5965

6066
# pkgdown site
61-
docs/
67+
/docs/
6268

6369
# translation temp files
6470
po/*~
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
In the Linear Gaussian DGP, we simulate the feature/design matrix $\mathbf{X} \in \mathbb{R}^{n \times p}$ from a normal distribution and the response vector $\mathbf{y} \in \mathbb{R}^n$ from a linear model. Specifically,
2+
3+
\begin{gather*}
4+
\mathbf{X} \sim N\left(\mathbf{0}, \begin{pmatrix} 1 & \rho \\ \rho & 1 \end{pmatrix}\right), \\
5+
\mathbf{y} = \mathbf{X} \boldsymbol{\beta} + \boldsymbol{\epsilon},\\
6+
\boldsymbol{\epsilon} \sim N(\mathbf{0}, \sigma^2 \mathbf{I}_n)
7+
\end{gather*}
8+
9+
**Default Parameters in DGP**
10+
11+
- Number of samples: $n = 200$
12+
- Number of features: $p = 2$
13+
- Correlation among features: $\rho = 0$
14+
- Amount of noise: $\sigma = 1$
15+
- Coefficients: $\boldsymbol{\beta} = (1, 0)^\top$
16+
17+
<span style="color: blue">
18+
[In practice, documentation of DGPs should answer the questions “what” and “why”. That is, “what” is the DGP, and “why” are we using/studying it? As this simulation experiment is a contrived example, we omit the “why” here.]
19+
</span>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
We define the rejection probability as the proportion of repetitions in the simulation experiment that result in a p-value $\leq \alpha$. Here, we choose to set the significance level $\alpha = 0.1$.
2+
3+
<span style="color: blue">
4+
[In practice, documentation of evaluation metrics should answer the questions “what” and “why”. That is, “what” is the metric, and “why” are we using/studying it? As this simulation experiment is a contrived example, we omit the “why” here.]
5+
</span>

vignettes/docs/methods/OLS.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Given some data $\mathbf{X}$ and $\mathbf{y}$, we fit ordinary least squares (OLS) and examine the p-values for each coefficient in the model. The p-values are computed using a two-sided t-test (see `summary.lm()`).
2+
3+
Elaborating further on the testing, we are interested in testing:
4+
5+
\begin{align*}
6+
H_0: \beta_i = 0 \quad vs. \quad H_1: \beta_i \neq 0.
7+
\end{align*}
8+
9+
To test this, we compute the observed T-statistic, defined as
10+
11+
\begin{align*}
12+
T = \frac{\hat{\beta}_i}{\hat{SE}(\hat{\beta_i})},
13+
\end{align*}
14+
15+
and then compute the two-sided p-value under the t distribution with $n - p - 1$ degrees of freedom. If the p-value is lower than some significance value $\alpha$, then there is sufficient evidence to reject the null hypothesis $H_0$. Otherwise, there is not sufficient evidence, and we fail to reject the null hypothesis.
16+
17+
<span style="color: blue">
18+
[In practice, documentation of methods should answer the questions “what” and “why”. That is, “what” is the method, and “why” are we using/studying it? As this simulation experiment is a contrived example, we omit the “why” here.]
19+
</span>

vignettes/docs/objectives.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The objective of this simulation experiment is to provide a toy example on how to use `simChef` and showcase the automated R Markdown-generated documentation. For the sake of illustration, this toy simulation experiment studies the performance of linear regression at the surface-level with the sole purpose of facilitating an easy-to-understand walkthrough.
2+
3+
<span style="color: blue">
4+
[Typically, the objective of the simulation experiment (and this blurb) will be more scientific than instructive and will warrant additional context/background and domain knowledge.]
5+
</span>

vignettes/docs/visualizers/Power.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
To examine the power of the test, we plot the rejection probability as a function of $\alpha$, that is, $\mathbb{P}(\text{p-value} \leq \alpha)$ vs. $\alpha$. If the coefficient is non-zero in the underlying DGP, then a larger AUC would indicate better performance in terms of the power. We will primarily focus on plotting the power of the first coefficient $\beta_1$.
2+
3+
<span style="color: blue">
4+
[In practice, documentation of the plotters should answer the questions “what” and “why”. That is, “what” is the plot, and “why” are we using/studying it? As this simulation experiment is a contrived example, we omit the “why” here.]
5+
</span>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
We plot the rejection probability for $\beta_1$ across varying parameters of the DGP to understand how characteristics of the DGP affect the test.
2+
We define the rejection probability as the proportion of repetitions in the simulation experiment that result in a p-value $\leq \alpha$. Here, we choose to set the significance level $\alpha = 0.1$.
3+
4+
<span style="color: blue">
5+
[In practice, documentation of the plotters should answer the questions “what” and “why”. That is, “what” is the plot, and “why” are we using/studying it? As this simulation experiment is a contrived example, we omit the “why” here.]
6+
</span>

0 commit comments

Comments
 (0)