From d02bb48678f8978c402d783a54bf92b28c389eca Mon Sep 17 00:00:00 2001 From: Degoot-AM Date: Mon, 28 Oct 2024 11:17:46 +0000 Subject: [PATCH 01/12] adding .Tex version of hands-out file --- learners/files/hands-on.tex | 150 +++++++++++++++++++ renv/activate.R | 103 ++++++++++++- renv/profiles/lesson-requirements/renv.lock | 155 ++++++++++---------- 3 files changed, 325 insertions(+), 83 deletions(-) create mode 100644 learners/files/hands-on.tex diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex new file mode 100644 index 00000000..abbe8e55 --- /dev/null +++ b/learners/files/hands-on.tex @@ -0,0 +1,150 @@ +\documentclass{article} +\usepackage{fancyhdr} + +% Set up the custom footer +\pagestyle{fancy} +\fancyfoot[R]{\thepage} % Centered page number in footer +\fancyfoot[C]{\textbf{License:} CC-BY.\textbf{Copyright:} Andree \& Degoot, 2024 } +\usepackage{tikz} +\usetikzlibrary{arrows.meta, positioning} +\usepackage{amsmath} +\author{Andree Valle Campos and Abdoelnaser M Degoot \\ Epiverse-TRACE Team @ LSHTM } +\title{Simple Introduction to Mathematical Modelling of Infectious Diseases} +\begin{document} +\maketitle + +\section{Intrdocution} +This document aims to assess and enhance your understanding of the fundamental +principles of mathematical modeling while guiding you in constructing models using +a simple SEIR framework for infectious disease outbreaks. + + \textbf{Note: Please fill in the blanks.} + +\section{SEIR Model} + + In the SEIR model, we have four compartments (\( S \), \( E \), \( I \), \( R \)): + +\begin{itemize} + \item \( S \) stands for \underline{\hspace{2cm}}, meaning \underline{\hspace{3cm}}. +The parameter that explains the transition from the Susceptible (\( S \)) compartment +to the Exposed (\( E \)) compartment is \underline{\hspace{6cm}}. +\item \(E\) stands for \underline{\hspace{2cm}}, meaning that it can + \underline{\hspace{3cm}}. + + The rate that explains the transition from (\( E \)) to (\( R \)) is the rate of \underline{\hspace{6cm}}. + + \item \( I \) stands for \underline{\hspace{2cm}}, meaning that it can + \underline{\hspace{3cm}}. + The rate that explains the transition from (\( I \)) to Recovered (\( R \)) is the rate of \underline{\hspace{6cm}}. + + \item \( R \) stands for \underline{\hspace{3cm}}. This compartment includes those who have ceased to be infectious and acquire immunity against infection, regardless of the clinical course. +\end{itemize} + +\section{\( R_0 \)} +\( R_0 \) helps project the potential +size of an epidemic and calculate the herd immunity threshold. +It is defined as the average number of \underline{\hspace{2cm}} secondary cases +generated from a primary case in a completely +\underline{\hspace{3cm}} population. + +\section{\( R_t \)} +\( R_t \) +helps monitor the progress of the epidemic +When the population is no longer \underline{\hspace{2cm}}, the instantaneous +reproduction number \( R_t \) is used. This is defined as the average number +of s\underline{\hspace{2cm}} in a population composed of +\underline{\hspace{2cm}} and non-\underline{\hspace{2cm}} individuals at time \( t \). + +\section{A Diagram for Measles outbreak} + +Below is a typical SEIR model with demography (births and deaths). This is a simple +model applicable to person-to-person infections in a homogeneously mixing population. +Please carefully observe the model and examine the interactions with the equations +in section \ref{eqs}. Use color codes or arrows to relate the diagram to the equations. + + +\begin{center} + \begin{tikzpicture}[ + node distance=2cm, + every node/.style={fill=blue!10, draw, minimum size=1cm, text centered}, + arrow/.style={-Stealth, thick} + ] + + % Nodes + \node [circle, fill=green!75](S) {$S$}; + \node [circle, fill=orange!75](E) [right=of S] { $E$}; + \node [circle, fill=red!75](I) [right=of E] {$I$}; + \node [circle, fill=blue!75](R) [right=of I] {$R$}; + + % Arrows for transitions + \draw[arrow] (S) -- node[above, draw=none] {$\beta S \frac{I}{N}$} (E); + \draw[arrow] (E) -- node[above, draw=none] {$\sigma E$} (I); + \draw[arrow] (I) -- node[above, draw=none] {$\gamma I$} (R); + + % Natural birth and death rates + \draw[arrow] (-2,0.0) -- node[above, draw=none] {$\Lambda N$} (S); + \draw[arrow] (S) -- +(0,-1.2) node[below, draw=none] {$\mu$}; + \draw[arrow] (E) -- +(0,-1.2) node[below, draw=none] {$\mu$ }; + \draw[arrow] (I) -- +(0,-1.2) node[below, draw=none] {$\mu$ }; + \draw[arrow] (R) -- +(0,-1.2) node[below, draw=none] {$\mu$}; + + \end{tikzpicture} +\end{center} + +Where: +\begin{itemize} + \item \( \beta \): Transmission rate + \item \( \sigma \): Rate of progression from exposed to infectious + \item \( \gamma \): Recovery rate + \item \( \mu \): Death rate (natural death rate) + \item \( N \): Total population size, \( N = S + E + I + R \). +\end{itemize} + + The parameter $\beta$ is derived from the multiplication of $p$ + and $c$, where $p$ is the probability of transmission during contact, and $c$ + is the contact rate, defined as the average number of contacts per unit of time. + +\section{Equations}\label{eqs} +Note that in the diagram, arrows entering compartments are expressed as positive +terms in the equations, while arrows exiting compartments are represented with negative terms. +Based on the above diagram,deduce the following equations that describe this system: + +\section*{Compartment Equations} + +\begin{itemize} + \item \textbf{Susceptible compartment:} + \[ + \frac{dS}{dt} = + \] + + \item \textbf{Exposed compartment:} + \[ + \frac{dE}{dt} = + \] + \item \textbf{Infectious compartment:} + \[ + \frac{dI}{dt} = \ + \] + + \item \textbf{Recovered compartment:} + \[ + \frac{dR}{dt} = + \] +\end{itemize} + +\section{Computing $R_0$} +The expression for the basic reproduction number ($R_0$) in the above system is given by: + +\begin{equation*} R_0 = \frac{\mu}{(\mu + \sigma)} \frac{\beta}{(\mu + \gamma)}. \end{equation*} + +To calculate the $R_0$ value for given parameter values, write an R function +called Measles$_r0$ that implements this formula. The function will use the following parameter values: + + \begin{itemize} + \item $\mu = \frac{1}{75}$ (natural mortality rate) + \item $\sigma = \frac{1}{10}$ (rate of progression from the exposed to the infectious stage) + \item $\gamma = 1/8$ (recovery rate) + \item $\beta = 1.8$ (transmission rate) + \end{itemize} + +\end{document} \ No newline at end of file diff --git a/renv/activate.R b/renv/activate.R index d13f9932..f1ebf988 100644 --- a/renv/activate.R +++ b/renv/activate.R @@ -98,6 +98,66 @@ local({ unloadNamespace("renv") # load bootstrap tools + ansify <- function(text) { + if (renv_ansify_enabled()) + renv_ansify_enhanced(text) + else + renv_ansify_default(text) + } + + renv_ansify_enabled <- function() { + + override <- Sys.getenv("RENV_ANSIFY_ENABLED", unset = NA) + if (!is.na(override)) + return(as.logical(override)) + + pane <- Sys.getenv("RSTUDIO_CHILD_PROCESS_PANE", unset = NA) + if (identical(pane, "build")) + return(FALSE) + + testthat <- Sys.getenv("TESTTHAT", unset = "false") + if (tolower(testthat) %in% "true") + return(FALSE) + + iderun <- Sys.getenv("R_CLI_HAS_HYPERLINK_IDE_RUN", unset = "false") + if (tolower(iderun) %in% "false") + return(FALSE) + + TRUE + + } + + renv_ansify_default <- function(text) { + text + } + + renv_ansify_enhanced <- function(text) { + + # R help links + pattern <- "`\\?(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:help:\\1\a?\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # runnable code + pattern <- "`(renv::(?:[^`])+)`" + replacement <- "`\033]8;;ide:run:\\1\a\\1\033]8;;\a`" + text <- gsub(pattern, replacement, text, perl = TRUE) + + # return ansified text + text + + } + + renv_ansify_init <- function() { + + envir <- renv_envir_self() + if (renv_ansify_enabled()) + assign("ansify", renv_ansify_enhanced, envir = envir) + else + assign("ansify", renv_ansify_default, envir = envir) + + } + `%||%` <- function(x, y) { if (is.null(x)) y else x } @@ -142,7 +202,10 @@ local({ # compute common indent indent <- regexpr("[^[:space:]]", lines) common <- min(setdiff(indent, -1L)) - leave - paste(substring(lines, common), collapse = "\n") + text <- paste(substring(lines, common), collapse = "\n") + + # substitute in ANSI links for executable renv code + ansify(text) } @@ -306,7 +369,11 @@ local({ ) if ("headers" %in% names(formals(utils::download.file))) - args$headers <- renv_bootstrap_download_custom_headers(url) + { + headers <- renv_bootstrap_download_custom_headers(url) + if (length(headers) && is.character(headers)) + args$headers <- headers + } do.call(utils::download.file, args) @@ -385,10 +452,22 @@ local({ for (type in types) { for (repos in renv_bootstrap_repos()) { + # build arguments for utils::available.packages() call + args <- list(type = type, repos = repos) + + # add custom headers if available -- note that + # utils::available.packages() will pass this to download.file() + if ("headers" %in% names(formals(utils::download.file))) + { + headers <- renv_bootstrap_download_custom_headers(url) + if (length(headers) && is.character(headers)) + args$headers <- headers + } + # retrieve package database db <- tryCatch( as.data.frame( - utils::available.packages(type = type, repos = repos), + do.call(utils::available.packages, args), stringsAsFactors = FALSE ), error = identity @@ -470,6 +549,14 @@ local({ } + renv_bootstrap_github_token <- function() { + for (envvar in c("GITHUB_TOKEN", "GITHUB_PAT", "GH_TOKEN")) { + envval <- Sys.getenv(envvar, unset = NA) + if (!is.na(envval)) + return(envval) + } + } + renv_bootstrap_download_github <- function(version) { enabled <- Sys.getenv("RENV_BOOTSTRAP_FROM_GITHUB", unset = "TRUE") @@ -477,16 +564,16 @@ local({ return(FALSE) # prepare download options - pat <- Sys.getenv("GITHUB_PAT") - if (nzchar(Sys.which("curl")) && nzchar(pat)) { + token <- renv_bootstrap_github_token() + if (nzchar(Sys.which("curl")) && nzchar(token)) { fmt <- "--location --fail --header \"Authorization: token %s\"" - extra <- sprintf(fmt, pat) + extra <- sprintf(fmt, token) saved <- options("download.file.method", "download.file.extra") options(download.file.method = "curl", download.file.extra = extra) on.exit(do.call(base::options, saved), add = TRUE) - } else if (nzchar(Sys.which("wget")) && nzchar(pat)) { + } else if (nzchar(Sys.which("wget")) && nzchar(token)) { fmt <- "--header=\"Authorization: token %s\"" - extra <- sprintf(fmt, pat) + extra <- sprintf(fmt, token) saved <- options("download.file.method", "download.file.extra") options(download.file.method = "wget", download.file.extra = extra) on.exit(do.call(base::options, saved), add = TRUE) diff --git a/renv/profiles/lesson-requirements/renv.lock b/renv/profiles/lesson-requirements/renv.lock index b66f1bb1..60ac1f98 100644 --- a/renv/profiles/lesson-requirements/renv.lock +++ b/renv/profiles/lesson-requirements/renv.lock @@ -1,6 +1,6 @@ { "R": { - "Version": "4.4.0", + "Version": "4.4.1", "Repositories": [ { "Name": "CRAN", @@ -20,7 +20,7 @@ "Package": "DBI", "Version": "1.2.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "methods" @@ -91,7 +91,7 @@ "Package": "R6", "Version": "2.5.1", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -101,7 +101,7 @@ "Package": "RColorBrewer", "Version": "1.1-3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -135,7 +135,7 @@ "Package": "askpass", "Version": "1.2.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "sys" ], @@ -145,7 +145,7 @@ "Package": "backports", "Version": "1.5.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -155,7 +155,7 @@ "Package": "base64enc", "Version": "0.1-3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -189,7 +189,7 @@ "Package": "blob", "Version": "1.2.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "methods", "rlang", @@ -243,7 +243,7 @@ "Package": "cachem", "Version": "1.1.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "fastmap", "rlang" @@ -254,7 +254,7 @@ "Package": "callr", "Version": "3.7.6", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -267,7 +267,7 @@ "Package": "cellranger", "Version": "1.1.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "rematch", @@ -302,7 +302,7 @@ "Package": "clipr", "Version": "0.8.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "utils" ], @@ -326,7 +326,7 @@ "Package": "conflicted", "Version": "1.2.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -392,7 +392,7 @@ "Package": "dbplyr", "Version": "2.5.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "DBI", "R", @@ -441,7 +441,7 @@ "Package": "dplyr", "Version": "1.1.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -464,7 +464,7 @@ "Package": "dtplyr", "Version": "1.3.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -488,7 +488,6 @@ "RemoteRepo": "epidemics", "RemoteUsername": "epiverse-trace", "RemotePkgRef": "epiverse-trace/epidemics", - "RemoteRef": "HEAD", "RemoteSha": "3813d22cb94c42b65efe1751912cee75ea08ece0", "Requirements": [ "BH", @@ -519,7 +518,7 @@ "Package": "fansi", "Version": "1.0.6", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "grDevices", @@ -531,14 +530,14 @@ "Package": "farver", "Version": "2.1.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Hash": "680887028577f3fa2a81e410ed0d6e42" }, "fastmap": { "Package": "fastmap", "Version": "1.2.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Hash": "aa5e1cd11c2d15497494c5292d7ffcc8" }, "fields": { @@ -559,7 +558,7 @@ "Package": "fontawesome", "Version": "0.5.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "htmltools", @@ -571,7 +570,7 @@ "Package": "forcats", "Version": "1.0.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -587,7 +586,7 @@ "Package": "fs", "Version": "1.6.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "methods" @@ -598,7 +597,7 @@ "Package": "gargle", "Version": "1.5.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -620,7 +619,7 @@ "Package": "generics", "Version": "0.1.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "methods" @@ -631,7 +630,7 @@ "Package": "ggplot2", "Version": "3.5.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "MASS", "R", @@ -656,7 +655,7 @@ "Package": "glue", "Version": "1.7.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "methods" @@ -667,7 +666,7 @@ "Package": "googledrive", "Version": "2.1.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -692,7 +691,7 @@ "Package": "googlesheets4", "Version": "1.1.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cellranger", @@ -720,7 +719,7 @@ "Package": "gtable", "Version": "0.3.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -735,7 +734,7 @@ "Package": "haven", "Version": "2.5.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -756,7 +755,7 @@ "Package": "highr", "Version": "0.11", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "xfun" @@ -767,7 +766,7 @@ "Package": "hms", "Version": "1.1.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "lifecycle", "methods", @@ -812,7 +811,7 @@ "Package": "httr", "Version": "1.4.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -827,7 +826,7 @@ "Package": "ids", "Version": "1.0.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "openssl", "uuid" @@ -861,7 +860,7 @@ "Package": "isoband", "Version": "0.2.7", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "grid", "utils" @@ -872,7 +871,7 @@ "Package": "jquerylib", "Version": "0.1.4", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "htmltools" ], @@ -908,7 +907,7 @@ "Package": "labeling", "Version": "0.4.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "graphics", "stats" @@ -934,7 +933,7 @@ "Package": "lifecycle", "Version": "1.0.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -947,7 +946,7 @@ "Package": "lubridate", "Version": "1.9.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "generics", @@ -960,7 +959,7 @@ "Package": "magrittr", "Version": "2.0.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -982,7 +981,7 @@ "Package": "memoise", "Version": "2.0.1", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "cachem", "rlang" @@ -1010,7 +1009,7 @@ "Package": "mime", "Version": "0.12", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "tools" ], @@ -1020,7 +1019,7 @@ "Package": "modelr", "Version": "0.1.11", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "broom", @@ -1038,7 +1037,7 @@ "Package": "munsell", "Version": "0.5.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "colorspace", "methods" @@ -1087,7 +1086,7 @@ "Package": "pillar", "Version": "1.9.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "cli", "fansi", @@ -1104,7 +1103,7 @@ "Package": "pkgconfig", "Version": "2.0.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "utils" ], @@ -1135,7 +1134,7 @@ "Package": "processx", "Version": "3.8.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -1173,7 +1172,7 @@ "Package": "purrr", "Version": "1.0.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -1199,7 +1198,7 @@ "Package": "rappdirs", "Version": "0.3.3", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -1209,7 +1208,7 @@ "Package": "readr", "Version": "2.1.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -1232,7 +1231,7 @@ "Package": "readxl", "Version": "1.4.3", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cellranger", @@ -1247,14 +1246,14 @@ "Package": "rematch", "Version": "2.0.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Hash": "cbff1b666c6fa6d21202f07e2318d4f1" }, "rematch2": { "Package": "rematch2", "Version": "2.1.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "tibble" ], @@ -1296,7 +1295,7 @@ "Package": "rlang", "Version": "1.1.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "utils" @@ -1330,14 +1329,14 @@ "Package": "rstudioapi", "Version": "0.16.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Hash": "96710351d642b70e8f02ddeb237c46a7" }, "rvest": { "Package": "rvest", "Version": "1.0.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -1370,7 +1369,7 @@ "Package": "scales", "Version": "1.3.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -1390,7 +1389,7 @@ "Package": "selectr", "Version": "0.4-2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "R6", @@ -1439,7 +1438,7 @@ "Package": "stringi", "Version": "1.8.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "stats", @@ -1452,7 +1451,7 @@ "Package": "stringr", "Version": "1.5.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -1469,14 +1468,17 @@ "Package": "sys", "Version": "3.4.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Hash": "3a1be13d68d47a8cd0bfd74739ca1555" }, "systemfonts": { "Package": "systemfonts", "Version": "1.1.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://carpentries.r-universe.dev", + "RemoteUrl": "https://github.com/r-lib/systemfonts", + "RemoteRef": "v1.1.0", + "RemoteSha": "78df90ca6d869feeb6a40c88f72269093505aa22", "Requirements": [ "R", "cpp11", @@ -1488,7 +1490,10 @@ "Package": "textshaping", "Version": "0.4.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://carpentries.r-universe.dev", + "RemoteUrl": "https://github.com/r-lib/textshaping", + "RemoteRef": "v0.4.0", + "RemoteSha": "76682df21dce8ef29e905a90dd05732a58b1249f", "Requirements": [ "R", "cpp11", @@ -1501,7 +1506,7 @@ "Package": "tibble", "Version": "3.2.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "fansi", @@ -1520,7 +1525,7 @@ "Package": "tidyr", "Version": "1.3.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -1543,7 +1548,7 @@ "Package": "tidyselect", "Version": "1.2.1", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -1559,7 +1564,7 @@ "Package": "tidyverse", "Version": "2.0.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "broom", @@ -1599,7 +1604,7 @@ "Package": "timechange", "Version": "0.3.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cpp11" @@ -1620,7 +1625,7 @@ "Package": "tzdb", "Version": "0.4.0", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cpp11" @@ -1631,7 +1636,7 @@ "Package": "utf8", "Version": "1.2.4", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -1651,7 +1656,7 @@ "Package": "vctrs", "Version": "0.6.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", @@ -1665,7 +1670,7 @@ "Package": "viridisLite", "Version": "0.4.2", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R" ], @@ -1693,7 +1698,7 @@ "Package": "vroom", "Version": "1.6.5", "Source": "Repository", - "Repository": "CRAN", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "bit64", @@ -1767,7 +1772,7 @@ "Package": "xml2", "Version": "1.3.6", "Source": "Repository", - "Repository": "RSPM", + "Repository": "https://packagemanager.posit.co/all/__linux__/jammy/latest", "Requirements": [ "R", "cli", From da5a7d840d1d815cbf8e3687f8de9a3449f8e493 Mon Sep 17 00:00:00 2001 From: Degoot-AM Date: Mon, 4 Nov 2024 21:28:21 +0000 Subject: [PATCH 02/12] add more questions --- learners/files/hands-on.tex | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index abbe8e55..921e977c 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -14,7 +14,7 @@ \maketitle \section{Intrdocution} -This document aims to assess and enhance your understanding of the fundamental +This document aims to assess your understanding of the fundamental principles of mathematical modeling while guiding you in constructing models using a simple SEIR framework for infectious disease outbreaks. @@ -26,8 +26,8 @@ \section{SEIR Model} \begin{itemize} \item \( S \) stands for \underline{\hspace{2cm}}, meaning \underline{\hspace{3cm}}. -The parameter that explains the transition from the Susceptible (\( S \)) compartment -to the Exposed (\( E \)) compartment is \underline{\hspace{6cm}}. +The parameter that explains the transition from (\( S \)) compartment +to (\( E \)) compartment is \underline{\hspace{6cm}}. \item \(E\) stands for \underline{\hspace{2cm}}, meaning that it can \underline{\hspace{3cm}}. @@ -35,7 +35,7 @@ \section{SEIR Model} \item \( I \) stands for \underline{\hspace{2cm}}, meaning that it can \underline{\hspace{3cm}}. - The rate that explains the transition from (\( I \)) to Recovered (\( R \)) is the rate of \underline{\hspace{6cm}}. + The rate that explains the transition from (\( I \)) to (\( R \)) is the rate of \underline{\hspace{6cm}}. \item \( R \) stands for \underline{\hspace{3cm}}. This compartment includes those who have ceased to be infectious and acquire immunity against infection, regardless of the clinical course. \end{itemize} @@ -112,21 +112,21 @@ \section{Equations}\label{eqs} \section*{Compartment Equations} \begin{itemize} - \item \textbf{Susceptible compartment:} + \item \textbf{S compartment:} \[ \frac{dS}{dt} = \] - \item \textbf{Exposed compartment:} + \item \textbf{E compartment:} \[ \frac{dE}{dt} = \] - \item \textbf{Infectious compartment:} + \item \textbf{I compartment:} \[ \frac{dI}{dt} = \ \] - \item \textbf{Recovered compartment:} + \item \textbf{R compartment:} \[ \frac{dR}{dt} = \] @@ -138,7 +138,7 @@ \section{Computing $R_0$} \begin{equation*} R_0 = \frac{\mu}{(\mu + \sigma)} \frac{\beta}{(\mu + \gamma)}. \end{equation*} To calculate the $R_0$ value for given parameter values, write an R function -called Measles$_r0$ that implements this formula. The function will use the following parameter values: +called Measles$R_0$ that implements this formula. The function will use the following parameter values: \begin{itemize} \item $\mu = \frac{1}{75}$ (natural mortality rate) @@ -146,5 +146,5 @@ \section{Computing $R_0$} \item $\gamma = 1/8$ (recovery rate) \item $\beta = 1.8$ (transmission rate) \end{itemize} - +Then compute the final size of such epidemic. \end{document} \ No newline at end of file From f0176ecefc92c681b96dab3f269a8fde2973bd97 Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:55:55 +0000 Subject: [PATCH 03/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 921e977c..070b84f3 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -13,7 +13,7 @@ \begin{document} \maketitle -\section{Intrdocution} +\section{Introduction} This document aims to assess your understanding of the fundamental principles of mathematical modeling while guiding you in constructing models using a simple SEIR framework for infectious disease outbreaks. From 2fe8ff3b91b3bc8ce81fca04bdd453e048919e88 Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:57:24 +0000 Subject: [PATCH 04/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 070b84f3..c0c7573f 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -29,7 +29,7 @@ \section{SEIR Model} The parameter that explains the transition from (\( S \)) compartment to (\( E \)) compartment is \underline{\hspace{6cm}}. \item \(E\) stands for \underline{\hspace{2cm}}, meaning that it can - \underline{\hspace{3cm}}. + \underline{\hspace{4cm}}. The rate that explains the transition from (\( E \)) to (\( R \)) is the rate of \underline{\hspace{6cm}}. From 2f16c6793baff2aafdd81bcfc115fc5dcfb483de Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:57:43 +0000 Subject: [PATCH 05/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index c0c7573f..7b5ad8af 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -14,7 +14,7 @@ \maketitle \section{Introduction} -This document aims to assess your understanding of the fundamental +This practical aims to assess your understanding of the fundamental principles of mathematical modeling while guiding you in constructing models using a simple SEIR framework for infectious disease outbreaks. From 14286509c7098e5c7c80fd070970f1e3a80adc38 Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:57:58 +0000 Subject: [PATCH 06/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 7b5ad8af..2a181085 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -25,7 +25,7 @@ \section{SEIR Model} In the SEIR model, we have four compartments (\( S \), \( E \), \( I \), \( R \)): \begin{itemize} - \item \( S \) stands for \underline{\hspace{2cm}}, meaning \underline{\hspace{3cm}}. + \item \( S \) stands for \underline{\hspace{2cm}}, meaning \underline{\hspace{6cm}}. The parameter that explains the transition from (\( S \)) compartment to (\( E \)) compartment is \underline{\hspace{6cm}}. \item \(E\) stands for \underline{\hspace{2cm}}, meaning that it can From 1fac7e4d5989bde65f744c28b0373a96252bdb0e Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:58:08 +0000 Subject: [PATCH 07/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 2a181085..5033dcc3 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -31,7 +31,7 @@ \section{SEIR Model} \item \(E\) stands for \underline{\hspace{2cm}}, meaning that it can \underline{\hspace{4cm}}. - The rate that explains the transition from (\( E \)) to (\( R \)) is the rate of \underline{\hspace{6cm}}. + The rate that explains the transition from (\( E \)) to (\( I \)) is the rate of \underline{\hspace{1cm}}. \item \( I \) stands for \underline{\hspace{2cm}}, meaning that it can \underline{\hspace{3cm}}. From e549b32111222671028b7fad0eb5c83ffc1526c5 Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:58:19 +0000 Subject: [PATCH 08/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 5033dcc3..ca275842 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -135,7 +135,7 @@ \section*{Compartment Equations} \section{Computing $R_0$} The expression for the basic reproduction number ($R_0$) in the above system is given by: -\begin{equation*} R_0 = \frac{\mu}{(\mu + \sigma)} \frac{\beta}{(\mu + \gamma)}. \end{equation*} +\begin{equation*} R_0 = \frac{\mu}{(\mu + \alpha)} \frac{\beta}{(\mu + \gamma)}. \end{equation*} To calculate the $R_0$ value for given parameter values, write an R function called Measles$R_0$ that implements this formula. The function will use the following parameter values: From 2b21c5e096245c2bde6e6bfbb5069cd330d1a698 Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:58:33 +0000 Subject: [PATCH 09/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index ca275842..9a4662e1 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -104,6 +104,15 @@ \section{A Diagram for Measles outbreak} and $c$, where $p$ is the probability of transmission during contact, and $c$ is the contact rate, defined as the average number of contacts per unit of time. +Model parameters are often (but not always) specified as rates. +The rate at which an event occurs is the inverse of the average time until that event. +For example, in the SEIR model, the recovery rate $\gamma$ is the inverse of the average infectious period.\\ + +Values of these rates can be determined from the natural history of the disease. +For example, if people are on average infectious for 8 days, then in the model, +1/8 of currently infectious people would recover each day +(i.e. the rate of recovery, $\gamma=1/8=0.125$). + \section{Equations}\label{eqs} Note that in the diagram, arrows entering compartments are expressed as positive terms in the equations, while arrows exiting compartments are represented with negative terms. From c971799254beb6a0e77c0375a5b2b250268fecb3 Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:58:45 +0000 Subject: [PATCH 10/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 9a4662e1..21bc1aad 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -151,7 +151,7 @@ \section{Computing $R_0$} \begin{itemize} \item $\mu = \frac{1}{75}$ (natural mortality rate) - \item $\sigma = \frac{1}{10}$ (rate of progression from the exposed to the infectious stage) + \item $\alpha = \frac{1}{10}$ (rate of progression from the exposed to the infectious stage) \item $\gamma = 1/8$ (recovery rate) \item $\beta = 1.8$ (transmission rate) \end{itemize} From 0bde5d0b2b4594aed4236c664a1b2030d00ca47d Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:58:58 +0000 Subject: [PATCH 11/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 21bc1aad..41ef422e 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -102,7 +102,7 @@ \section{A Diagram for Measles outbreak} The parameter $\beta$ is derived from the multiplication of $p$ and $c$, where $p$ is the probability of transmission during contact, and $c$ - is the contact rate, defined as the average number of contacts per unit of time. + is the contact rate, defined as the average number of contacts per unit of time.\\ Model parameters are often (but not always) specified as rates. The rate at which an event occurs is the inverse of the average time until that event. From d17d6f08bfd71e76826625a7cefbd910ec0411fa Mon Sep 17 00:00:00 2001 From: Abdoelnaser M Degoot Date: Wed, 20 Nov 2024 20:59:10 +0000 Subject: [PATCH 12/12] Update learners/files/hands-on.tex Co-authored-by: Andree Valle Campos --- learners/files/hands-on.tex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/learners/files/hands-on.tex b/learners/files/hands-on.tex index 41ef422e..c04a34a6 100644 --- a/learners/files/hands-on.tex +++ b/learners/files/hands-on.tex @@ -16,7 +16,7 @@ \section{Introduction} This practical aims to assess your understanding of the fundamental principles of mathematical modeling while guiding you in constructing models using -a simple SEIR framework for infectious disease outbreaks. +a simple SEIR framework for infectious disease outbreaks.\\ \textbf{Note: Please fill in the blanks.}