The goal of facilityepimath is to provide functions to calculate useful quantities for a user-defined differential equation model of infectious disease transmission among individuals in a healthcare facility, including the basic facility reproduction number and model equilibrium. A full description and derivation of the mathematical results implemented in these functions can be found in the following manuscript:
Toth D, Khader K, Mitchell M, Samore M (2025). Transmission thresholds for the spread of infections in healthcare facilities. https://doi.org/10.1101/2025.02.21.25322698.
This work was supported by the Centers for Disease Control and Prevention, Modeling Infectious Diseases in Healthcare Network award U01CK000585.
You can install the development version of facilityepimath from GitHub with:
devtools::install_github("EpiForeSITE/facilityepimath")
You can install the facilitymath from CRAN with:
install.packages("facilityepimath")
The functions in this package analyze compartmental differential equation models, where the compartments are states of individuals who are co-located in a healthcare facility, for example, patients in a hospital or patients/residents of long-term care facility.
Our example here is a hospital model with four compartments: two
compartments
A system of differential equations with those 4 compartments may take the following general form:
The acquisition rate
We will demonstrate how to calculate the basic reproduction number facilityR0
function. The following components
of the system are required as inputs to the function call below.
A matrix S
governing the transitions between, and out of, the states
A matrix C
governing the transitions between, and out of, the states
A matrix A
describing the S-to-C state transitions when an acquisition
occurs:
A vector transm
containing the
A vector initS
containing the admission state probabilities for the
susceptible compartments only (i.e., the pre-invasion system before a
colonized patient is introduced):
A function mgf(x,deriv)
that is the moment-generating function (and
its derivatives) of the distribution for which the
time-of-stay-dependent removal rate h(t)
is the hazard function. This
is the length of stay distribution when the state-dependent removal
rates
library(facilityepimath)
S <- rbind(c(-1,2),c(1,-2))
C <- rbind(c(-1.1,0),c(0.1,-0.9))
A <- rbind(c(1,0),c(0,2))
transm <- c(0.4,0.6)
initS <- c(0.9,0.1)
mgf <- function(x, deriv=0) MGFgamma(x, rate=0.01, shape=3.1, deriv)
facilityR0(S,C,A,transm,initS,mgf)
#> [1] 0.7244774