diff --git a/.github/workflows/check-spelling.yaml b/.github/workflows/check-spelling.yaml index 6ae8dfa4c..bef448266 100644 --- a/.github/workflows/check-spelling.yaml +++ b/.github/workflows/check-spelling.yaml @@ -18,6 +18,8 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v3 + with: + submodules: recursive - name: Run Spelling Check test uses: insightsengineering/r-spellcheck-action@v3.0.2 diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index 637cebb27..4ebbc907e 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -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 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e48500fc8..870ab86a8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -13,6 +13,8 @@ jobs: steps: - name: Check out repository uses: actions/checkout@HEAD + with: + submodules: recursive - name: list files shell: bash diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..ca85f235c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "latex-macros"] + path = latex-macros + url = https://github.com/d-morrison/macros.git diff --git a/README.Rmd b/README.Rmd index 2e8f6f76c..1100aa44d 100644 --- a/README.Rmd +++ b/README.Rmd @@ -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. diff --git a/SUBMODULE_SETUP.md b/SUBMODULE_SETUP.md new file mode 100644 index 000000000..ae7357a36 --- /dev/null +++ b/SUBMODULE_SETUP.md @@ -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 +``` diff --git a/_OUTTAKES-time-to-event models.qmd b/_OUTTAKES-time-to-event models.qmd index f6ebe29fb..2d93578ae 100644 --- a/_OUTTAKES-time-to-event models.qmd +++ b/_OUTTAKES-time-to-event models.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ## Acknowledgements{.unnumbered} diff --git a/_coxph-model-structure.qmd b/_coxph-model-structure.qmd index f41043c2b..d62af532d 100644 --- a/_coxph-model-structure.qmd +++ b/_coxph-model-structure.qmd @@ -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)$ diff --git a/_def-hazard.qmd b/_def-hazard.qmd index 49ba7ce9e..22ece7b74 100644 --- a/_def-hazard.qmd +++ b/_def-hazard.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#def-hazard} ##### Hazard function, hazard rate, hazard rate function diff --git a/_def-km-estimator.qmd b/_def-km-estimator.qmd index aeaeb384f..f3455444a 100644 --- a/_def-km-estimator.qmd +++ b/_def-km-estimator.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#def-KM-estimator} diff --git a/_def-ph-partial-lik.qmd b/_def-ph-partial-lik.qmd index 4a6307c61..65936036f 100644 --- a/_def-ph-partial-lik.qmd +++ b/_def-ph-partial-lik.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} $$ \ba diff --git a/_def_conditional_odds.qmd b/_def_conditional_odds.qmd index c1b16622f..27ba42cd6 100644 --- a/_def_conditional_odds.qmd +++ b/_def_conditional_odds.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ::: notes This course is about regression models, diff --git a/_exm_wcgs_coef_interp.qmd b/_exm_wcgs_coef_interp.qmd index 9ae25ffe9..11ac94a6c 100644 --- a/_exm_wcgs_coef_interp.qmd +++ b/_exm_wcgs_coef_interp.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-logistic-coef-interp} diff --git a/_exr-bernoulli-score.qmd b/_exr-bernoulli-score.qmd index 6b8a2bd02..968607bac 100644 --- a/_exr-bernoulli-score.qmd +++ b/_exr-bernoulli-score.qmd @@ -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$. diff --git a/_exr-double-exponentials.qmd b/_exr-double-exponentials.qmd index 42440a5e6..0a6860a02 100644 --- a/_exr-double-exponentials.qmd +++ b/_exr-double-exponentials.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-double-exponential} diff --git a/_exr-exp-score.qmd b/_exr-exp-score.qmd index f26fcb250..0120aaaca 100644 --- a/_exr-exp-score.qmd +++ b/_exr-exp-score.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ::: {#exr-exp-score-fn} diff --git a/_exr-gauss-score.qmd b/_exr-gauss-score.qmd index ba41abf87..214fd987f 100644 --- a/_exr-gauss-score.qmd +++ b/_exr-gauss-score.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ::: {#exr-gauss-score-fn} diff --git a/_exr-pois-score.qmd b/_exr-pois-score.qmd index 4afb9650f..9b53ec192 100644 --- a/_exr-pois-score.qmd +++ b/_exr-pois-score.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ::: {#exr-pois-score-fn} diff --git a/_exr-review-exp-dist.qmd b/_exr-review-exp-dist.qmd index 5a07c4670..fb6166941 100644 --- a/_exr-review-exp-dist.qmd +++ b/_exr-review-exp-dist.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-review-exp-dist} Recall the key characteristics of the exponential distribution: diff --git a/_sec-likelihood-with-censoring.qmd b/_sec-likelihood-with-censoring.qmd index e93740e61..cb12653de 100644 --- a/_sec-likelihood-with-censoring.qmd +++ b/_sec-likelihood-with-censoring.qmd @@ -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: diff --git a/_sec-score.qmd b/_sec-score.qmd index 7d62ecb4b..09f5c5c0e 100644 --- a/_sec-score.qmd +++ b/_sec-score.qmd @@ -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*. diff --git a/_sec-surv-conditional-hazards.qmd b/_sec-surv-conditional-hazards.qmd index 7c8ef23c0..ab67c503c 100644 --- a/_sec-surv-conditional-hazards.qmd +++ b/_sec-surv-conditional-hazards.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#def-cond-hazard} #### conditional hazard diff --git a/_sec-surv-dists.qmd b/_sec-surv-dists.qmd index 87b78be51..94ff730a8 100644 --- a/_sec-surv-dists.qmd +++ b/_sec-surv-dists.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ### The Probability Density Function (PDF) {.smaller} diff --git a/_sec-survival-dist-fns.qmd b/_sec-survival-dist-fns.qmd index ee81c59a7..ff2642ae4 100644 --- a/_sec-survival-dist-fns.qmd +++ b/_sec-survival-dist-fns.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} Name | Symbols | Definition :-------------- | ------ | ---------- diff --git a/_sec-understand-coxph.qmd b/_sec-understand-coxph.qmd index 157209fb1..dcc74b9b4 100644 --- a/_sec-understand-coxph.qmd +++ b/_sec-understand-coxph.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} diff --git a/_sec_OR_inference.qmd b/_sec_OR_inference.qmd index e1c3f07ce..570ef84bb 100644 --- a/_sec_OR_inference.qmd +++ b/_sec_OR_inference.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-ci-OR} Given diff --git a/_sec_OR_logistic.qmd b/_sec_OR_logistic.qmd index f1cb6d426..3493b94eb 100644 --- a/_sec_OR_logistic.qmd +++ b/_sec_OR_logistic.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-logistic-OR-general} diff --git a/_sec_OR_objections.qmd b/_sec_OR_objections.qmd index 92171dafa..4fcf8a410 100644 --- a/_sec_OR_objections.qmd +++ b/_sec_OR_objections.qmd @@ -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]. diff --git a/_sec_derive_logistic_hessian.qmd b/_sec_derive_logistic_hessian.qmd index f0c968289..80004922f 100644 --- a/_sec_derive_logistic_hessian.qmd +++ b/_sec_derive_logistic_hessian.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} $$ {\hess(\vb)} = \sumin \olive{\hess_i(\vb)} diff --git a/_sec_derive_logistic_loglik.qmd b/_sec_derive_logistic_loglik.qmd index 610c5e923..201c96830 100644 --- a/_sec_derive_logistic_loglik.qmd +++ b/_sec_derive_logistic_loglik.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-logistic-loglik} diff --git a/_sec_derivs_MLE.qmd b/_sec_derivs_MLE.qmd index 1772135e4..5fbcb20ed 100644 --- a/_sec_derivs_MLE.qmd +++ b/_sec_derivs_MLE.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{.callout-note} diff --git a/_sec_exm_wcgs.qmd b/_sec_exm_wcgs.qmd index 4c3f54038..1b280b8f0 100644 --- a/_sec_exm_wcgs.qmd +++ b/_sec_exm_wcgs.qmd @@ -4,7 +4,7 @@ format: df-print: tibble --- -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} {{< include _sec_intro_wcgs.qmd >}} diff --git a/_sec_fit-coxph.qmd b/_sec_fit-coxph.qmd index 99fcd2371..9365d0cf7 100644 --- a/_sec_fit-coxph.qmd +++ b/_sec_fit-coxph.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} --- diff --git a/_sec_intro_bernoulli_models.qmd b/_sec_intro_bernoulli_models.qmd index 598f99207..5cb412943 100644 --- a/_sec_intro_bernoulli_models.qmd +++ b/_sec_intro_bernoulli_models.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ## Risk estimation and prediction diff --git a/_sec_invodds.qmd b/_sec_invodds.qmd index 1283c7a74..79ebaeb0b 100644 --- a/_sec_invodds.qmd +++ b/_sec_invodds.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-odds-to-prob} diff --git a/_sec_likelihood.qmd b/_sec_likelihood.qmd index 29b089972..4faa315d0 100644 --- a/_sec_likelihood.qmd +++ b/_sec_likelihood.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ### The likelihood function diff --git a/_sec_linear_coef_interp_intxn.qmd b/_sec_linear_coef_interp_intxn.qmd index da03bf05f..eb55eede3 100644 --- a/_sec_linear_coef_interp_intxn.qmd +++ b/_sec_linear_coef_interp_intxn.qmd @@ -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]? diff --git a/_sec_logistic-fitting.qmd b/_sec_logistic-fitting.qmd index b80c3e196..0091b0e91 100644 --- a/_sec_logistic-fitting.qmd +++ b/_sec_logistic-fitting.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ### Model diff --git a/_sec_logistic_score_fn.qmd b/_sec_logistic_score_fn.qmd index 9b67e41dd..4ccb4beb7 100644 --- a/_sec_logistic_score_fn.qmd +++ b/_sec_logistic_score_fn.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} As usual, by independence, we have: diff --git a/_sec_logistic_slope_mean.qmd b/_sec_logistic_slope_mean.qmd index 47ab36a93..e71b32290 100644 --- a/_sec_logistic_slope_mean.qmd +++ b/_sec_logistic_slope_mean.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#lem-d_logodds-d_x} diff --git a/_sec_odds.qmd b/_sec_odds.qmd index 89ec9a505..b3de983cd 100644 --- a/_sec_odds.qmd +++ b/_sec_odds.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} {{< include _def-odds.qmd >}} diff --git a/_sec_odds_fn.qmd b/_sec_odds_fn.qmd index cf5e0c842..a8fbfb2bc 100644 --- a/_sec_odds_fn.qmd +++ b/_sec_odds_fn.qmd @@ -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. diff --git a/_sec_odds_ratios.qmd b/_sec_odds_ratios.qmd index 98ee7e4fa..61fe81b67 100644 --- a/_sec_odds_ratios.qmd +++ b/_sec_odds_ratios.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ::: notes diff --git a/_sec_one_cov_logistic.qmd b/_sec_one_cov_logistic.qmd index 51944fefc..636650655 100644 --- a/_sec_one_cov_logistic.qmd +++ b/_sec_one_cov_logistic.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} --- diff --git a/_sec_overview_bernoulli_models.qmd b/_sec_overview_bernoulli_models.qmd index c9de8cd3f..0398d2155 100644 --- a/_sec_overview_bernoulli_models.qmd +++ b/_sec_overview_bernoulli_models.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#exr-def-logistic-regression} diff --git a/_sec_pois-reg_intro.qmd b/_sec_pois-reg_intro.qmd index 985456702..10180ab30 100644 --- a/_sec_pois-reg_intro.qmd +++ b/_sec_pois-reg_intro.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ::: notes This chapter presents models for diff --git a/_sol-double-exponential.qmd b/_sol-double-exponential.qmd index e2e5598e6..fcb0c38f2 100644 --- a/_sol-double-exponential.qmd +++ b/_sol-double-exponential.qmd @@ -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: diff --git a/_surv_diagram.qmd b/_surv_diagram.qmd index 6937b37b6..df2de3791 100644 --- a/_surv_diagram.qmd +++ b/_surv_diagram.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} $$ \pdf(t) diff --git a/_thm-d_pi_d_beta.qmd b/_thm-d_pi_d_beta.qmd index 74066b242..6b741e07d 100644 --- a/_thm-d_pi_d_beta.qmd +++ b/_thm-d_pi_d_beta.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} :::{#thm-d_pi_d_beta} diff --git a/algebra.qmd b/algebra.qmd index 715daf1cb..bd38e7da3 100644 --- a/algebra.qmd +++ b/algebra.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ## Elementary Algebra diff --git a/coxph-model-building.qmd b/coxph-model-building.qmd index 630e66d16..ac4e88021 100644 --- a/coxph-model-building.qmd +++ b/coxph-model-building.qmd @@ -1,4 +1,4 @@ -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ## Building Cox Proportional Hazards models diff --git a/dobson-cyclone-example.qmd b/dobson-cyclone-example.qmd index 77cb494aa..9496946dd 100644 --- a/dobson-cyclone-example.qmd +++ b/dobson-cyclone-example.qmd @@ -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 diff --git a/estimation.qmd b/estimation.qmd index 34974df86..856779d1e 100644 --- a/estimation.qmd +++ b/estimation.qmd @@ -2,7 +2,7 @@ ## Probabilistic models {.scrollable} -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} --- diff --git a/glms.qmd b/glms.qmd index 29d23b541..c9763cb2f 100644 --- a/glms.qmd +++ b/glms.qmd @@ -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: diff --git a/inst/WORDLIST b/inst/WORDLIST index 5239835aa..bb308a762 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -2,6 +2,7 @@ Biostat Epi Github Hua +LaTeX MathJax NoDerivatives NonCommercial @@ -11,5 +12,9 @@ UC Zhou callout demstats +gitmodules github qmd +recurse +submodule +submodules diff --git a/latex-macros b/latex-macros new file mode 160000 index 000000000..902bab8ad --- /dev/null +++ b/latex-macros @@ -0,0 +1 @@ +Subproject commit 902bab8adc68a21725edb126d58cb6b07be18063 diff --git a/macros.qmd b/macros.qmd deleted file mode 100644 index c7588919f..000000000 --- a/macros.qmd +++ /dev/null @@ -1,385 +0,0 @@ -\providecommand{\cbl}[1]{\left\{#1\right.} -\providecommand{\cb}[1]{{\left\{#1\right\}}} -\providecommand{\cbmat}[1]{{\left\{\begin{matrix}#1\end{matrix}\right\}}} -\providecommand{\paren}[1]{{\left(#1\right)}} -\providecommand{\pmat}[1]{\begin{pmatrix}#1\end{pmatrix}} -\providecommand{\sparen}[1]{(#1)} -\providecommand{\sb}[1]{{\left[#1\right]}} -\def\distop{\text} -\providecommand{\sbmat}[1]{\begin{bmatrix}#1\end{bmatrix}} -\providecommand{\Prf}[1]{\Pr\paren{#1}} -\def\am{\arg \max} -\def\argmax{\arg \max} -\def\p{\distop{p}} -\def\f{\distop{f}} -\def\F{\distop{F}} -\def\h{\distop{h}} -\def\H{\distop{H}} -\def\pr{\p} -\def\dens{\p} -\def\pdens{\p} -\def\fdens{\f} -\def\mass{\P} -\def\pmass{\P} -\def\fmass{\F} -\def\S{\distop{S}} -\providecommand{\Sf}[1]{\S\paren{#1}} -\def\surv{\distop{S}} -\providecommand{\survf}[1]{\surv\paren{#1}} -\def\ph{\hat{\p}} -\def\P{\distop{P}} -\def\hp{\hat{\p}} -\def\ga{\alpha} -\def\a{\alpha} -\def\b{\beta} -\def\g{\gamma} -\providecommand{\floor}[1]{\left \lfloor{#1}\right \rfloor} -\providecommand{\ceiling}[1]{\left \lceil{#1}\right \rceil} -\providecommand{\ceil}[1]{\left \lceil{#1}\right \rceil} -\def\Ber{\text{Ber}} -\def\Bernoulli{\text{Bernoulli}} -\def\Pois{\text{Pois}} -\def\Poisson{\text{Poisson}} -\def\Gaus{\text{Gaussian}} -\def\Normal{\text{N}} -\providecommand{\ndist}[1]{\Normal\paren{#1}} -\def\NB{\text{NegBin}} -\def\NegBin{\text{NegBin}} -\def\vbeta{\vec \beta} -\def\vb{\vec \b} -\def\v0{\vec{0}} -\def\vzero{\vec{0}} -\def\gb{\beta} -\def\gg{\gamma} -\def\gd{\delta} -\def\eps{\varepsilon} -\def\veps{\vec{\varepsilon}} -\providecommand{\epsp}[1]{\eps\paren{#1}} -\providecommand{\epsf}[1]{\eps\paren{#1}} -\def\om{\omega} -\def\m{\mu} -\def\mean{\mu} -\def\pmean{\mu} -\def\popmean{\mu} -\def\vm{\vec \m} -\def\s{\sigma} -\def\l{\lambda} -\def\gl{\lambda} -\def\lam{\lambda} -\def\gs{\sigma} -\def\gm{\mu} -\def\M{\text{M}} -\def\gM{\text{M}} -\def\Mu{\text{M}} -\def\cd{\cdot} -\def\cds{\cdots} -\def\lds{\ldots} -\def\eqdef{\stackrel{\text{def}}{=}} -\def\defeq{\stackrel{\text{def}}{=}} -\def\hb{\hat \beta} -\def\hvb{\hat{\vb}} -\def\hl{\hat \lambda} -\def\hy{\hat y} -\def\yh{\hat y} -\def\V{{\text{Var}}} -\def\hs{\hat \sigma} -\def\hsig{\hat \sigma} -\def\hS{\hat \Sigma} -\def\hSig{\hat \Sigma} -\def\hSigma{\hat \Sigma} -\def\hsurv{\hat{\surv}} -\def\hSurv{\hat{\surv}} -\providecommand{\hSurvf}[1]{\hSurv\paren{#1}} -\def\dist{\ \sim \ } -\def\ddist{\ \dot{\sim} \ } -\def\dsim{\ \dot{\sim} \ } -\def\za{z_{1 - \frac{\alpha}{2}}} -\def\cirad{\za \cdot \hse{\hb}} -\def\ci{\hb {\color{red}\pm} \cirad} -\def\th{\theta} -\def\vth{\vec{\theta}} -\def\Th{\Theta} -\def\xbar{\bar{x}} -\def\hth{\hat\theta} -\def\hthml{\hth_{\text{ML}}} -\def\ba{\begin{aligned}} -\def\ea{\end{aligned}} -\def\ind{\perp\!\!\!\perp} -\def\indpt{\ind} -\def\indold{⫫} -\def\all{\forall} -\def\iid{\text{iid}} -\def\ciid{\text{ciid}} -\def\simind{\ \sim_{\ind}\ } -\def\siid{\ \sim_{\iid}\ } -\def\sciid{\ \sim_{\ciid}\ } -\def\simiid{\siid} -\def\distiid{\siid} -\def\tf{\therefore} -\def\Lik{\mathscr{L}} -\def\llik{\ell} -\def\loglik{\ell} -\def\logl{\ell} -\providecommand{\llikf}[1]{\llik \paren{#1}} -\def\deviation{\eps} -\def\devn{\eps} -\def\score{\ell'} -\def\scorev{\vec{\ell'}} -\def\scorei{\vec{\ell_i'}} -\def\scorevi{\vec{\ell_i'}} -\providecommand{\scoref}[1]{\score \paren{#1}} -\def\hess{\llik''} -\def\hessm{\llik''} -\def\hessian{\hess} -\def\hessij{\llik_{ij}''} -\def\hessijalt{\sb{\hess}_{ij}} -\providecommand{\hessf}[1]{\hess \paren{#1}} -\providecommand{\hessianf}[1]{\hess \paren{#1}} -\providecommand{\starf}[1]{#1^*} -\def\lik{\ell} -\providecommand{\est}[1]{\widehat{#1}} -\providecommand{\esttmp}[1]{{\widehat{#1}}^*} -\def\esttmpl{\esttmp{\lambda}} -\def\cR{\mathcal{R}} -\def\range{\mathcal{R}} -\def\Range{\mathcal{R}} -\providecommand{\rangef}[1]{\cR(#1)} -\def\~{\approx} -\def\dapp{\dot\approx} -\providecommand{\deriv}[1]{\frac{\partial}{\partial #1}} -\providecommand{\dderiv}[1]{\frac{\partial^2}{\partial #1^2}} -\providecommand{\derivf}[2]{\frac{\partial #1}{\partial #2}} -\providecommand{\derivff}[2]{\frac{\partial #2}{\partial #1}} -\providecommand{\dderivf}[2]{\frac{\partial^2 #1}{\partial #2^2}} -\providecommand{\xderiv}[2]{\frac{\partial^2}{\partial #1 \partial #2}} -\providecommand{\xderivf}[3]{\frac{\partial^2 #1}{\partial #2 \partial #3}} -\providecommand{\xderivff}[3]{\frac{\partial^2 #3}{\partial #1 \partial #2}} - -\providecommand{\red}[1]{{\color{red}#1}} -\providecommand{\green}[1]{{\color{green}#1}} -\providecommand{\blue}[1]{{\color{blue}#1}} -\providecommand{\cyan}[1]{{\color{cyan}#1}} -\providecommand{\magenta}[1]{{\color{magenta}#1}} -\providecommand{\yellow}[1]{{\color{yellow}#1}} -\providecommand{\black}[1]{{\color{black}#1}} -\providecommand{\gray}[1]{{\color{gray}#1}} -\providecommand{\white}[1]{{\color{white}#1}} -\providecommand{\darkgray}[1]{{\color{darkgray}#1}} -\providecommand{\lightgray}[1]{{\color{lightgray}#1}} -\providecommand{\brown}[1]{{\color{brown}#1}} -\providecommand{\lime}[1]{{\color{lime}#1}} -\providecommand{\olive}[1]{{\color{olive}#1}} -\providecommand{\orange}[1]{{\color{orange}#1}} -\providecommand{\pink}[1]{{\color{purple}#1}} -\providecommand{\purple}[1]{{\color{purple}#1}} -\providecommand{\teal}[1]{{\color{teal}#1}} -\providecommand{\violet}[1]{{\color{violet}#1}} -\providecommand{\hE}[1]{\hat{\text{E}}\sb{#1}} -\providecommand{\hExp}[1]{\hat{\text{E}}\sb{#1}} -\providecommand{\hExpf}[1]{\hat{\text{E}}\sb{#1}} -\providecommand{\hmu}[1]{\hat{\mu}\sb{#1}} -\def\Expp{\distop{E}} -\def\Ep{\distop{E}} -\def\expit{\text{expit}} -\providecommand{\expitf}[1]{\expit\cb{#1}} -\providecommand{\dexpitf}[1]{\expit'\cb{#1}} -\def\logit{\text{logit}} -\providecommand{\logitf}[1]{\logit\cb{#1}} -\providecommand{\E}[1]{\distop{E}\sb{#1}} -\providecommand{\Ef}[1]{\distop{E}\sb{#1}} -\providecommand{\Exp}[1]{\distop{E}\sb{#1}} -\providecommand{\Expf}[1]{\distop{E}\sb{#1}} -\providecommand{\Expfc}[2]{\distop{E}_{#1}\sb{#2}} -\providecommand{\evalAt}[2]{\left.{#1}\right|_{#2}} -\def\Varr{\text{Var}} -\def\Vart{\text{Var}} -\def\hvar{\widehat{\Vart}} -\def\hvart{\widehat{\Vart}} -\def\Covt{\text{Cov}} -\def\hcovt{\widehat{\Covt}} -\def\hCovt{\widehat{\Covt}} -\providecommand{\var}[1]{\text{Var}\paren{#1}} -\providecommand{\varf}[1]{\text{Var}\paren{#1}} -\providecommand{\Var}[1]{\text{Var}\paren{#1}} -\providecommand{\hVar}[1]{\widehat{\text{Var}}\paren{#1}} -\providecommand{\Varf}[1]{\text{Var}\paren{#1}} -\providecommand{\hvarf}[1]{\hvart\paren{#1}} -\providecommand{\Cov}[1]{\Covt \paren{#1}} -\providecommand{\Covs}[2]{\Covt \paren{#1, #2}} -\providecommand{\Covf}[1]{\Covt \paren{#1}} -\providecommand{\covh}[1]{\widehat{\Covt}\paren{#1}} -\providecommand{\covhf}[1]{\widehat{\Covt}\paren{#1}} -\providecommand{\hcovf}[1]{\widehat{\Covt}\paren{#1}} -\def\varht{\widehat{\text{Var}}} -\providecommand{\varh}[1]{\varht\paren{#1}} -\providecommand{\varhf}[1]{\varht\paren{#1}} -\providecommand{\vc}[1]{\boldsymbol{#1}} -\providecommand{\sd}[1]{\text{sd}\paren{#1}} -\providecommand{\SD}[1]{\text{SD}\paren{#1}} -\providecommand{\hSD}[1]{\widehat{\text{SD}}\paren{#1}} -\providecommand{\hSDf}[1]{\widehat{\text{SD}}\paren{#1}} -\providecommand{\se}[1]{\text{se}\paren{#1}} -\def\hset{\widehat{\text{se}}} -\def\hSE{\widehat{\text{SE}}} -\def\hSEt{\widehat{\text{SE}}} -\providecommand{\sef}[1]{\text{se}\paren{#1}} -\providecommand{\hse}[1]{\widehat{\text{se}}\paren{#1}} -\providecommand{\hsef}[1]{\widehat{\text{se}}\paren{#1}} -\providecommand{\SE}[1]{\text{SE}\paren{#1}} -\providecommand{\SEf}[1]{\text{SE}\paren{#1}} -\providecommand{\SDf}[1]{\text{SD}\paren{#1}} -\providecommand{\HSE}[1]{\widehat{\text{SE}}\paren{#1}} -\providecommand{\hSEf}[1]{\widehat{\text{SE}}\paren{#1}} -\def\logt{\text{log}} -\providecommand{\logf}[1]{\logt\cb{#1}} -\def\dlog{\logt'} -\providecommand{\dlogf}[1]{\dlog \cb{#1}} -\renewcommand{\exp}[1]{\text{exp}\cb{#1}} -\def\expt{\text{exp}} -\providecommand{\expf}[1]{\text{exp}\cb{#1}} -\providecommand{\expfn}[1]{\expf{#1}} -\def\dexp{\text{exp}'} -\providecommand{\dexpf}[1]{\dexp \cb{#1}} -\providecommand{\e}[1]{\text{e}^{#1}} -\providecommand{\ef}[1]{\text{e}^{#1}} -\providecommand{\inv}[1]{\paren{#1}^{-1}} -\providecommand{\invf}[1]{\paren{#1}^{-1}} -\providecommand{\invp}[1]{\paren{#1}^{-1}} -\providecommand{\invcb}[1]{\cb{#1}^{-1}} -\providecommand{\invsb}[1]{\sb{#1}^{-1}} -\def\oinf{I} -\def\oinfm{\mat{I}} -\def\Nat{\distop{N}} -\providecommand{\oinff}[1]{\oinf\paren{#1}} -\def\einf{\mathcal{I}} -\def\EInf{\einf} -\def\FInf{\einf} -\def\einfm{\mathcal{I}} -\providecommand{\einff}[1]{\einf\paren{#1}} -\def\heinf{\hat{\einf}} -\providecommand{\heinff}[1]{\heinf \paren{#1}} -\providecommand{\1}[1]{\distop{1}_{#1}} -\providecommand{\indic}[1]{\mathbb{1}_{#1}} -\providecommand{\indicp}[1]{\mathbb{1}\paren{#1}} -\providecommand{\indiccb}[1]{\mathbb{1}\cb{#1}} -\providecommand{\set}[1]{\cb{#1}} -\providecommand{\pf}[1]{\p \paren{#1}} -\providecommand{\Pf}[1]{\P \paren{#1}} -\providecommand{\Bias}[1]{\text{Bias}\paren{#1}} -\providecommand{\bias}[1]{\text{Bias}\paren{#1}} -\def\ss{\sigma^2} -\providecommand{\ssqf}[1]{\sigma^2\paren{#1}} -\providecommand{\mselr}[1]{\text{MSE}\paren{#1}} -\providecommand{\maelr}[1]{\text{MAE}\paren{#1}} -\providecommand{\abs}[1]{\left|#1\right|} -\providecommand{\sqf}[1]{\paren{#1}^2} -\providecommand{\sq}{^2} -\def\err{\eps} -\providecommand{\erf}[1]{\err\paren{#1}} -\renewcommand{\vec}[1]{\tilde{#1}} -\providecommand{\vecf}[1]{\tilde{#1}} -\providecommand{\v}[1]{\vecf{#1}} -\providecommand{\matr}[1]{\mathbf{#1}} -\def\mX{\matr{X}} -\def\mx{\matr{x}} -\def\va{\vecf{a}} -\def\vx{\vecf{x}} -\def\vxs{{\vec{x}^*}} -\def\diff{\Delta} -\def\diffvx{\diff\vx} -\def\vxi{\vecf{x}_i} -\def\vX{\vecf{X}} -\def\vy{\vecf{y}} -\def\vY{\vecf{Y}} -\def\vD{\vecf{D}} -\def\vd{\vecf{d}} -\def\vT{\vecf{T}} -\def\vt{\vecf{t}} -\def\v1{\vec{1}} -\def\vpi{\vecf{\pi}} -\providecommand{\mat}[1]{\mathbf{#1}} -\providecommand{\dsn}[1]{#1_1, \ldots, #1_n} -\def\X1n{\dsn{X}} -\def\Xin{\dsn{X}} -\def\x1n{\dsn{x}} -\def\y1n{\dsn{y}} -\def\'{^{\top}} -\providecommand{\pt}[1]{\paren{#1}\'} -\providecommand{\tp}[1]{{#1}\'} -\def\dpr{\cdot} -\def\Xx1n{X_1=x_1, \ldots, X_n = x_n} -\providecommand{\dprodf}[2]{#1 \cdot #2} -\providecommand{\dsvn}[2]{#1_1=#2_1, \ldots, #1_n = #2_n} -\providecommand{\sumn}[1]{\sum_{#1=1}^n} -\def\sumin{\sum_{i=1}^n} -\def\sumiN{\sum_{i=1}^N} -\def\sumip{\sum_{i=1}^p} -\def\sumjn{\sum_{j=1}^n} -\def\sumjp{\sum_{j=1}^p} -\def\sumi1n{\sum_{i=1}^n} -\def\prodin{\prod_{i=1}^n} -\def\prodi1n{\prod_{i=1}^n} -\providecommand{\lp}[2]{#1 \' \beta} -\def\odds{\omega} -\def\OR{\text{OR}} -\def\ror{\theta} - - -\def\logodds{\eta} -\providecommand{\logoddsf}[1]{\logodds \paren{#1}} -\def\difflogodds{\Delta \eta} -\def\hdifflogodds{\widehat{\Delta \eta}} -\def\diffeta{\Delta \eta} -\def\oddst{\text{odds}} -\def\OR{\text{OR}} -\def\probst{\text{probs}} -\def\probt{\text{prob}} -\def\riskt{\text{risk}} -\def\prob{\pi} -\def\probs{\pi} -\def\probit{\text{probit}} -\providecommand{\oddsf}[1]{\oddst\cb{#1}} -\providecommand{\doddsf}[1]{{\oddst}'\cb{#1}} -\def\oddsinv{\oddst^{-1}} -\def\invodds{\text{invodds}} -\providecommand{\oddsinvf}[1]{\oddsinv\cb{#1}} -\providecommand{\invoddsf}[1]{\invodds\cb{#1}} -\providecommand{\doddsinvf}[1]{{\oddsinv}'\cb{#1}} -\providecommand{\dinvoddsf}[1]{{\invodds}'\cb{#1}} -\def\rate{{\lambda}} -\def\haz{{\lambda}} -\def\hazratio{\theta} -\def\hr{\theta} -\providecommand{\hrf}[1]{\theta\paren{#1}} -\def\loghaz{\eta} -\def\diffloghaz{\Delta \eta} -\def\cuhaz{{\Lambda}} -\def\cumhaz{\cuhaz} -\def\Surv{\surv} -\def\incidence{\bar{\haz}} -\def\phaz{\Expf{\haz}} -\def\idmat{\mathbb{I}} -\def\and{\cap} -\def\reglincomb{\vx \cdot \vb} -\def\regbetasum{\beta_1 x_1+ \dots + \beta_p x_p} -\def\pdf{\distop{f}} -\def\cdf{\distop{F}} -\def\defLik{\Lik(\theta) \eqdef \p(\vX = \vx | \Theta = \theta)} -\def\defLogLik{\lik \eqdef \logf{\Lik(\vx|\th)}} -\def\defScore{\score \eqdef \deriv{\th} \lik(\vx|\th)} -\def\defHess{\hess \eqdef \deriv{\vth}\deriv{\vth\'} \llik(\vx | \vth)} -\def\thmHessij{\hessij = -\deriv{\th_i}\deriv{\th_j} \llik(\vX = \vx | \vth)} -\def\defOInf{\oinf \eqdef -\hess(\vx|\vth)} -\def\defEInf{\einf \eqdef \E{\oinf(\vx|\theta)}} -\def\thmADistMLE{\hth_{ML}\ \dot \sim\ \ndist{\th,\sb{\einf(\vth)}^{-1}}} -\def\eqGLMRatio{\ror(\vx,\vxs) = \exp{(\diffvx) \cdot \vb}} -\def\defHR{\hr(t| \vx : \vxs) \eqdef \frac{\haz(t|\vx)}{\haz(t|\vxs)}} -\def\kerngaus{\frac{-1}{2}\frac{(x-\mu)^2}{\ss}} -\def\likgaus{\paren{2\pi\ss}^{-1/2}\expf{\kerngaus}} -\def\llgaus{\frac{-1}{2}\paren{\logf{2\pi\ss} + \frac{\devn^2}{\ss}}} -\def\scoreexpf{\frac{\devn}{\Varf{X}}} -\def\llexpmean{-\logf{\pmean} - \frac{x}{\pmean}} -\def\signt{\text{sign}} -\providecommand{\signf}[1]{\signt\cb{#1}} -\def\reals{\mathbb{R}} diff --git a/math-prereqs.qmd b/math-prereqs.qmd index 0ff6774cb..8586aa90a 100644 --- a/math-prereqs.qmd +++ b/math-prereqs.qmd @@ -1,6 +1,6 @@ # Mathematics -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} --- diff --git a/midterm-formula-sheet.qmd b/midterm-formula-sheet.qmd index 39aaed9aa..c53f0abe8 100644 --- a/midterm-formula-sheet.qmd +++ b/midterm-formula-sheet.qmd @@ -10,7 +10,7 @@ quarto render "midterm-formula-sheet.qmd" --profile "handout" --output "exam-for # Exam formula sheet -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ## Epi 202: Probability diff --git a/notation.qmd b/notation.qmd index ed2e00887..e790acce8 100644 --- a/notation.qmd +++ b/notation.qmd @@ -1,6 +1,6 @@ # Notation {#sec-notation} -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} | symbol | meaning | LaTeX |-------------|--------------------------------------------------|----------- diff --git a/shared-config.qmd b/shared-config.qmd index 02137e1f7..e2153a87d 100644 --- a/shared-config.qmd +++ b/shared-config.qmd @@ -1,5 +1,5 @@ {{< include r-config.qmd >}} -{{< include macros.qmd >}} +{{< include latex-macros/macros.qmd >}} ```{=html}