Skip to content

Commit ac2e960

Browse files
committed
Fix the name of the vital dynamics parameters
1 parent d72c9a0 commit ac2e960

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: ehpi
22
Title: A Basic Compartmental Epidemic Modelling API
3-
Version: 0.7.0
3+
Version: 0.8.0
44
Language: en-CA
55
Authors@R:
66
c(person(given = "Bryce", family = "Carson",

R/epi.R

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#' workshops run by Dr. Krishnamurthy.
2424
#'
2525
#' @param population The initial number of persons in the simulation; if
26-
#' `vitalDynamics = TRUE` and `muB` and `muD` are equal, then it is constant.
26+
#' `vitalDynamics = TRUE` and `muBirth` and `muDeath` are equal, then it is constant.
2727
#' @param susceptible The initial number of people who are susceptible to the
2828
#' disease (they have no natural immunity to it).
2929
#' @param exposed The initial number of people who have been exposed to the
@@ -41,11 +41,11 @@
4141
#' @param sigma The rate of becoming recovered (no longer infectious).
4242
#' @param delta The rate of fatality.
4343
#' @param xi The rate of loss of learned immunity.
44-
#' @param muB The rate of birth.
45-
#' @param muD The rate of death not due to the disease under consideration.
44+
#' @param muBirth The rate of birth.
45+
#' @param muDeath The rate of death not due to the disease under consideration.
4646
#'
4747
#' @param vitalDynamics Whether vital dynamics is enabled (if `FALSE`, the
48-
#' default, implies muB and muD of zero).
48+
#' default, implies muBirth and muDeath of zero).
4949
#' @param trueMassAction Whether the force of infection is scaled by the
5050
#' population or not.
5151
#'
@@ -78,7 +78,7 @@ epi <-
7878
population, susceptible, exposed = 0, infected, recovered, dead = 0,
7979

8080
## Parameters (not alphabetically sorted)
81-
beta, gamma, sigma = 0, delta = 0, xi = 0, muB = 0, muD = 0,
81+
beta, gamma, sigma = 0, delta = 0, xi = 0, muBirth = 0, muDeath = 0,
8282

8383
## Simulation options
8484
vitalDynamics = FALSE,
@@ -91,9 +91,9 @@ epi <-
9191
variables <- c(population, susceptible, exposed, infected, recovered, dead)
9292
names(variables) <- c("N", "S", "E", "I", "R", "D")
9393
parameters <- c(beta, gamma, sigma, delta, xi,
94-
muB * vitalDynamics,
95-
muD * vitalDynamics)
96-
names(parameters) <- c("beta", "gamma", "sigma", "delta", "xi", "muB", "muD")
94+
muBirth * vitalDynamics,
95+
muDeath * vitalDynamics)
96+
names(parameters) <- c("beta", "gamma", "sigma", "delta", "xi", "muBirth", "muDeath")
9797

9898
## Prevent lsoda from being called with conflicting argument values.
9999
if(delta == 0) stopifnot(dead == 0)
@@ -121,21 +121,21 @@ epi <-
121121

122122
## Regardless of exposure
123123
betaSIN <- beta * ((S * I) / N^trueMassAction)
124-
dS <- c(muB * N, -betaSIN, -muD * S)
124+
dS <- c(muBirth * N, -betaSIN, -muDeath * S)
125125
dD <- delta * I # Always zero if delta == 0.
126126

127127
## Define the IR compartments with respect to the E compartment.
128128
if(sigma == 0) {
129129
## Without exposure, there is no E compartment. γ has its meaning as
130130
## in an SI-type model.
131-
compartments <- list(dI = c((betaSIN), -(gamma * I), -(muD * I)),
132-
dR = c((gamma * I), -(muD * R)))
131+
compartments <- list(dI = c((betaSIN), -(gamma * I), -(muDeath * I)),
132+
dR = c((gamma * I), -(muDeath * R)))
133133
} else {
134134
## With exposure, there is is an E compartment. γ has its meaning as
135135
## in an SEI-type model.
136-
compartments <- list(dE = c((betaSIN), -(gamma * E), -(muD * E)),
137-
dI = c((gamma * E), -(sigma * I), -(muD * I)),
138-
dR = c((sigma * I), -(muD * R)))
136+
compartments <- list(dE = c((betaSIN), -(gamma * E), -(muDeath * E)),
137+
dI = c((gamma * E), -(sigma * I), -(muDeath * I)),
138+
dR = c((sigma * I), -(muDeath * R)))
139139
}
140140

141141
## Enable loss of immunity if xi is non-zero.
@@ -149,7 +149,7 @@ epi <-
149149
if (delta != 0) compartments$dI <- c(compartments$dI, -dD)
150150

151151
## NOTE: dD is already equal to its sum, and is not part of the
152-
## calculation of dN. dN is non-zero if muB != muD. Name dS again; it is
152+
## calculation of dN. dN is non-zero if muBirth != muD. Name dS again; it is
153153
## helpful while debugging and printing the compartmentSums.
154154
compartmentSums <- lapply(append(list(dS = dS), compartments), sum)
155155
dN <- Reduce(`+`, compartmentSums)

man/epi.Rd

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)