Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/check-spelling.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive

- name: Run Spelling Check test
uses: insightsengineering/[email protected]
2 changes: 2 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@HEAD
with:
submodules: recursive

- name: list files
shell: bash
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "latex-macros"]
path = latex-macros
url = https://github.com/d-morrison/macros.git
16 changes: 16 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ title: "`rme`: Regression Models for Epidemiology"
format: md
---

## Getting Started

This repository uses a git submodule for LaTeX macros. When cloning, use:

```bash
git clone --recurse-submodules https://github.com/d-morrison/rme.git
```

Or if already cloned:

```bash
git submodule update --init --recursive
```

For more details, see [SUBMODULE_SETUP.md](SUBMODULE_SETUP.md).

## Code of Conduct

Please note that the `rme` project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
43 changes: 43 additions & 0 deletions SUBMODULE_SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# LaTeX Macros Submodule Setup

## ✅ Setup Complete!

The LaTeX macros submodule has been successfully configured and is now tracking the remote repository at https://github.com/d-morrison/macros.git.

### Current Status

- ✅ Submodule URL: https://github.com/d-morrison/macros.git
- ✅ Submodule path: `latex-macros/`
- ✅ Current commit: 902bab8
- ✅ All 52 `.qmd` files updated to reference `latex-macros/macros.qmd`
- ✅ GitHub Actions workflows configured to checkout submodules

## For Future Clones

After the submodule is properly set up on GitHub, others cloning this repository should run:

```bash
git clone --recurse-submodules https://github.com/d-morrison/rme.git
```

Or if already cloned:

```bash
git submodule update --init --recursive
```

## Updating the Macros

To update the macros in the future:

```bash
cd latex-macros
# Make changes to macros.qmd
git add macros.qmd
git commit -m "Update macros"
git push
cd ..
git add latex-macros # Update the submodule reference
git commit -m "Update latex-macros submodule"
git push
```
2 changes: 1 addition & 1 deletion _OUTTAKES-time-to-event models.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

## Acknowledgements{.unnumbered}

Expand Down
2 changes: 1 addition & 1 deletion _coxph-model-structure.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

**Joint likelihood of data set**:
$\Lik \eqdef \p(\vY= \vy, \vD = \vd | \mX = \mx)$
Expand Down
2 changes: 1 addition & 1 deletion _def-hazard.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}
:::{#def-hazard}

##### Hazard function, hazard rate, hazard rate function
Expand Down
2 changes: 1 addition & 1 deletion _def-km-estimator.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#def-KM-estimator}

Expand Down
2 changes: 1 addition & 1 deletion _def-ph-partial-lik.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

$$
\ba
Expand Down
2 changes: 1 addition & 1 deletion _def_conditional_odds.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: notes
This course is about regression models,
Expand Down
2 changes: 1 addition & 1 deletion _exm_wcgs_coef_interp.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-logistic-coef-interp}

Expand All @@ -17,7 +17,7 @@

```{r}
# include: false
age_offset = 0L

Check warning on line 20 in _exm_wcgs_coef_interp.qmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=_exm_wcgs_coef_interp.qmd,line=20,col=12,[assignment_linter] Use one of <-, <<- for assignment, not =.
```

$$
Expand Down
2 changes: 1 addition & 1 deletion _exr-bernoulli-score.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-derive-bernoulli-score}
Derive the score function for a single Bernoulli random variable $X$.
Expand Down
2 changes: 1 addition & 1 deletion _exr-double-exponentials.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-double-exponential}

Expand Down
2 changes: 1 addition & 1 deletion _exr-exp-score.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: {#exr-exp-score-fn}

Expand Down
2 changes: 1 addition & 1 deletion _exr-gauss-score.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: {#exr-gauss-score-fn}

Expand Down
2 changes: 1 addition & 1 deletion _exr-pois-score.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: {#exr-pois-score-fn}

Expand Down
2 changes: 1 addition & 1 deletion _exr-review-exp-dist.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-review-exp-dist}
Recall the key characteristics of the exponential distribution:
Expand Down
2 changes: 1 addition & 1 deletion _sec-likelihood-with-censoring.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

If an event time $T$ is observed exactly as $T=t$, then the likelihood
of that observation is just its probability density function:
Expand Down
2 changes: 1 addition & 1 deletion _sec-score.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

The first derivative^[a.k.a. the [gradient](https://en.wikipedia.org/wiki/Gradient)] of the log-likelihood, $\lik'(\th)$, is important enough to have its own name: the *score function*.

Expand Down
2 changes: 1 addition & 1 deletion _sec-surv-conditional-hazards.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#def-cond-hazard}
#### conditional hazard
Expand Down
2 changes: 1 addition & 1 deletion _sec-surv-dists.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

### The Probability Density Function (PDF) {.smaller}

Expand Down
2 changes: 1 addition & 1 deletion _sec-survival-dist-fns.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

Name | Symbols | Definition
:-------------- | ------ | ----------
Expand Down
2 changes: 1 addition & 1 deletion _sec-understand-coxph.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

<!-- {{< include _sec_cox-bio.qmd >}} -->

Expand Down
2 changes: 1 addition & 1 deletion _sec_OR_inference.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-ci-OR}
Given
Expand Down
2 changes: 1 addition & 1 deletion _sec_OR_logistic.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-logistic-OR-general}

Expand Down
2 changes: 1 addition & 1 deletion _sec_OR_objections.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

Some scholars have raised objections to the use of odds ratios as
an effect measurement [@sackett1996down; @norton2024requiem].
Expand Down
2 changes: 1 addition & 1 deletion _sec_derive_logistic_hessian.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

$$
{\hess(\vb)} = \sumin \olive{\hess_i(\vb)}
Expand Down
2 changes: 1 addition & 1 deletion _sec_derive_logistic_loglik.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-logistic-loglik}

Expand Down
2 changes: 1 addition & 1 deletion _sec_derivs_MLE.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{.callout-note}

Expand Down
2 changes: 1 addition & 1 deletion _sec_exm_wcgs.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ format:
df-print: tibble
---

{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

{{< include _sec_intro_wcgs.qmd >}}

Expand Down
2 changes: 1 addition & 1 deletion _sec_fit-coxph.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

---

Expand Down
2 changes: 1 addition & 1 deletion _sec_intro_bernoulli_models.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

## Risk estimation and prediction

Expand Down
2 changes: 1 addition & 1 deletion _sec_invodds.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-odds-to-prob}

Expand Down
2 changes: 1 addition & 1 deletion _sec_likelihood.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

### The likelihood function

Expand Down
2 changes: 1 addition & 1 deletion _sec_linear_coef_interp_intxn.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: {#exr-male-coef-intxn-model}
What is the interpretation of $\beta_{M}$ in [Model @eq-BW-lm-interact]?
Expand Down
2 changes: 1 addition & 1 deletion _sec_logistic-fitting.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

### Model

Expand Down
2 changes: 1 addition & 1 deletion _sec_logistic_score_fn.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

As usual, by independence, we have:

Expand Down
2 changes: 1 addition & 1 deletion _sec_logistic_slope_mean.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#lem-d_logodds-d_x}

Expand Down
2 changes: 1 addition & 1 deletion _sec_odds.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

{{< include _def-odds.qmd >}}

Expand Down
2 changes: 1 addition & 1 deletion _sec_odds_fn.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: {#exr-prob-to-odds}
Find a general formula for converting probabilities into odds.
Expand Down
2 changes: 1 addition & 1 deletion _sec_odds_ratios.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: notes

Expand Down
2 changes: 1 addition & 1 deletion _sec_one_cov_logistic.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

---

Expand Down
2 changes: 1 addition & 1 deletion _sec_overview_bernoulli_models.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#exr-def-logistic-regression}

Expand Down
2 changes: 1 addition & 1 deletion _sec_pois-reg_intro.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

::: notes
This chapter presents models for
Expand Down
2 changes: 1 addition & 1 deletion _sol-double-exponential.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

If $(a^b)^c = a^{(b^c)}$, then since $(a^b)^c = a^{bc}$,
we have:
Expand Down
2 changes: 1 addition & 1 deletion _surv_diagram.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

$$
\pdf(t)
Expand Down
2 changes: 1 addition & 1 deletion _thm-d_pi_d_beta.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

:::{#thm-d_pi_d_beta}

Expand Down
2 changes: 1 addition & 1 deletion algebra.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

## Elementary Algebra

Expand Down
2 changes: 1 addition & 1 deletion coxph-model-building.qmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

## Building Cox Proportional Hazards models

Expand Down
2 changes: 1 addition & 1 deletion dobson-cyclone-example.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

### Data {#sec-dobson-cyclones-data}

{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

The `cyclones` dataset in the `dobson` package (@tbl-cyclones-data)
records the number of tropical cyclones in Northeastern Australia
Expand Down
2 changes: 1 addition & 1 deletion estimation.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Probabilistic models {.scrollable}

{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

---

Expand Down
2 changes: 1 addition & 1 deletion glms.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

---

{{< include macros.qmd >}}
{{< include latex-macros/macros.qmd >}}

This section is primarily adapted starting from the textbook "An Introduction to Generalized Linear Models" (4th edition, 2018)
by Annette J. Dobson and Adrian G. Barnett:
Expand Down
Loading
Loading