## ℹ Loading epicyst
The set_up() function provides the user a means to
specify parameters and starting conditions for a model run. Input
parameters, as well as starting prevalence for Taeniasis, and
Cysticercosis (in the porcine and human populations) may be left at the
default values or specified in the function call.
Changes to default prevalence values will initiate a re-estimation of
transmission parameters to allow the system to run at the newly
specified endemic equilibrium. The set_up() function
returns a list of two elements: 1) The input parameters for a model run
(standardized time units and dependent parameters included) and 2)
Initial state variable values.
To initiate and view default parameters:
## $tau
## [1] 1.740746e-10
##
## $PPS
## [1] 2000
##
## $HPS
## [1] 10000
##
## $bH
## [1] 15.4321
##
## $dH
## [1] 0.00154321
##
## $dP
## [1] 0.008333333
## $SHC0
## [1] 58.13559 53.20885 48.69962 114.33825 111.24802 81.18099 219.18867
## $IH0
## [1] 15.76271 14.42689 13.20427 31.00133 30.16346 22.01117 59.43017
Input arguments for set_up() are documented in the help
file ?set_up(). Certain combinations of input prevalence
may not be possible to fit, in which case an error message will be
thrown.
In the age-structured model, human and pig compartments are
stratified into age groups. For pigs, there are 150 age groups (one
month per group) in the default model, which can be viewed (and
modified) through the following input
number_age_classes_pig = 150 for the number of pig age
classes, and pig_age_class_width = 1 for the width (in
months) of these age groups.
For humans in the default model, there are 7 age groups, representing
0 - 4.99, 5 - 9.99, 10 - 14.99, 15 - 29.99, 30 - 49.99, 50 - 69.99 and
70 - 89.99 years. These age groups are structured to include school-age
children (5 - 9.99 & 10 - 14.99 yrs). While there is an input to
change these number_age_classes_human = 7, currently
EPICYST is not configured to enable differing numbers of human age
classes (future developments will address this).
Figure 1 below provides a representation of the age-structure in the model, including demographic and transmission parameters.
Input parameters into set_up() specify additional
age-specific features in the pig age-structured model. Firstly, the
slaughter_age_min = 6 input specifies the minimum age (in
months) in which pigs are slaughtered, which is set to 6 months in the
default model. Secondly, the slgEP = 1 specifies the number
of years pigs are expected live, on average, after reaching slaughter
age (a default for the average natural life expectancy for pigs is also
specified by LEP = 10).
Figure 2 below highlights how pig demographics have been incorporated
into the age-structured EPICYST, which simulates pigs before the minimum
slaughter age experiencing a constant natural mortality rate (dP; the
reciprocal of the natural life expectancy parameter, LEP),
and pigs after reaching the minimum slaughter age experiencing an
additional mortality rate associated with reduced survival due to
slaughter (dPslg; the reciprocal of the average life expectancy after
reaching slaughter age, slgEP). Equally, humans are only
exposed to infected pork from slaughter age animals.
Other
modifiable parameter inputs, impacting baseline demographic parameters
in
set_up(), human population size HPS, pig
population size PPS, human life expectancy (in years)
LEH, and the rate of pork meal procurement in humans
chi.
EPICYST can also be parameterised for specific epidemiological
conditions by specifying epidemiological parameters in
set_up(), including Egg to pig transmission coefficient
tau_input, Egg to pig transmission coefficient
theta_input, Pig to human transmission coefficient
beta_input, and the proportion of pigs with low-cyst burden
phi.
The run_model() function provides all functionality for
model runs. To run the model at baseline, with default parameters and
endemic equilibrium values, only the length of the model run (specified
in years) need be specified:
| t | E | SH[1] | SH[2] | SH[3] | SH[4] | SH[5] | SH[6] | SH[7] |
|---|---|---|---|---|---|---|---|---|
| 0.0 | 88372603 | 772.4 | 706.9 | 647 | 1519.1 | 1478 | 1078.5 | 2912.1 |
| 0.0 | 88372603 | 772.4 | 706.9 | 647 | 1519.1 | 1478 | 1078.5 | 2912.1 |
| 0.1 | 88372602 | 772.5 | 706.9 | 647 | 1519.1 | 1478 | 1078.5 | 2912.1 |
| 0.1 | 88372602 | 772.5 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| 0.1 | 88372602 | 772.5 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| 0.2 | 88372602 | 772.6 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| 0.2 | 88372605 | 772.6 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| 0.2 | 88372610 | 772.7 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| 0.3 | 88372619 | 772.7 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| 0.3 | 88372634 | 772.8 | 706.9 | 647 | 1519.0 | 1478 | 1078.5 | 2912.0 |
| t | SP[1] | SP[2] | PP[1] | PP[2] | IPL[1] | IPL[2] | IPH[1] | IPH[2] |
|---|---|---|---|---|---|---|---|---|
| 0.0 | 98.5 | 97.6 | 0.0 | 0.0 | 19.7 | 19.5 | 4.9 | 4.9 |
| 0.0 | 99.2 | 97.6 | 0.0 | 0.0 | 19.0 | 19.5 | 4.8 | 4.9 |
| 0.1 | 99.9 | 97.6 | 0.1 | 0.1 | 18.4 | 19.5 | 4.6 | 4.9 |
| 0.1 | 100.6 | 97.6 | 0.1 | 0.1 | 17.8 | 19.4 | 4.5 | 4.9 |
| 0.1 | 101.2 | 97.6 | 0.2 | 0.2 | 17.2 | 19.4 | 4.3 | 4.8 |
| 0.2 | 101.9 | 97.7 | 0.2 | 0.2 | 16.7 | 19.3 | 4.2 | 4.8 |
| 0.2 | 102.5 | 97.8 | 0.3 | 0.3 | 16.1 | 19.2 | 4.0 | 4.8 |
| 0.2 | 103.1 | 97.8 | 0.3 | 0.3 | 15.6 | 19.1 | 3.9 | 4.8 |
| 0.3 | 103.7 | 97.9 | 0.3 | 0.4 | 15.1 | 19.0 | 3.8 | 4.7 |
| 0.3 | 104.2 | 98.1 | 0.4 | 0.4 | 14.6 | 18.8 | 3.6 | 4.7 |
| t | Human_Taeniasis_prev | Human_Cysticercosis_prev | Pig_Cysticercosis_prev | Human_total | Pig_total | |
|---|---|---|---|---|---|---|
| 17992 | 599.70 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17993 | 599.73 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17994 | 599.77 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17995 | 599.80 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17996 | 599.83 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17997 | 599.87 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17998 | 599.90 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 17999 | 599.93 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 18000 | 599.97 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
| 18001 | 600.00 | 0.02 | 0.06 | 0.11 | 10000 | 2000 |
It is suggested that a period of burn in (specified in years) is included to ensure small changes in endemic equilibrium at the start of a run are avoided:
Model output starts after this burn in period.
The model can be run with different starting parameters or endemic prevalence’s. For example to run the model with an prevalence of Taeniasis of 4%:
# Set up the model, specifying the new Taeniasis prevalence
s1 <- set_up(TPrev = 0.04)
# Run the model, with new input parameters and initial conditions
m3 <- run_model(time = 50, burn_in = 100, params = s1[[1]], initial_states = s1[[2]])Model runs return a data.frame of model output for each
time step. The model output data.frame facilitates visualization using
general base R or other plotting methods (e.g.,
ggplot2).
# Plot the output in base R
plot(m3$Pig_Cysticercosis_prev*100 ~ m3$t, type="l", col="darkmagenta", ylim=c(0,20), ylab = 'prevalence (%)', xlab = 'time (months)')
lines(m3$Human_Cysticercosis_prev*100 ~ m3$t, type="l", col="deeppink")
lines(m3$Human_Taeniasis_prev*100 ~ m3$t, type="l", col="dodgerblue")
legend('topright', c('porcine cysticercosis', 'human cysticercosis', 'human taeniasis'), lty = c(1, 1, 1),
col=c('darkmagenta', 'deeppink', 'dodgerblue'))The user can also specify diagnostic parameters in
set_up() to adjust modelled prevalence to observed/apparent
prevalence by providing the sensitivity and specificity characteristics
of a particular diagnostic test. This will allow the user to plot both
the true modelled prevalence, and adjusted observed/apparent prevalence,
as described in Figure 3 below
To run this in the model, this can be specified as (e.g. with a hypothetical 90% sensitivity and 80% specificity of a porcine cysticercosis diagnostic test) :
The age-structured model can be configured to remove age-structuring,
and therefore provide the original model presented in Winskill et
al. 2017. To specify the non age-structured model, the following
parameter inputs need to be included in set_up(). :
# Set up the model, specifying the non age-structured model
s1 <- set_up( number_age_classes_human = 1, number_age_classes_pig = 1, slaughter_age_min = 0)
# Run the model, with new input parameters and initial conditions
m5 <- run_model(time = 50, burn_in = 100, params = s1[[1]], initial_states = s1[[2]])This will collapse age groups so that only one age group is modelled for human and pig state variables:
| t | SH[1] | SHC[1] | IH[1] | IHC[1] | SP[1] | PP[1] | IPL[1] | IPH[1] | RP[1] | VP[1] |
|---|---|---|---|---|---|---|---|---|---|---|
| 0.0 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.0 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.1 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.1 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.1 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.2 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.2 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.2 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.3 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
| 0.3 | 9621.4 | 295.7 | 79.3 | 3.6 | 1812.2 | 26.8 | 128.8 | 32.2 | 0 | 0 |
If the user wishes to specify the complete original model presented
in Winskill et al. 2017 with no age-structuring, and no pre-patent
compartment in pigs (Pp compartments in Figure 1), then the user can set
the rate at which pigs progress from the pre-patent compartment to a
very high value (by setting the average duration pig remain in the
pre-patent compartment parameter psi to a very small value
i.e. 1 / 0.0000001) to effectively negate the use of this compartment as
follows:
# Set up the model, specifying the non age-structured model
s1 <- set_up( number_age_classes_human = 1, number_age_classes_pig = 1, slaughter_age_min = 0,
psi = 1/ 0.0000001)
# Run the model, with new input parameters and initial conditions
m6 <- run_model(time = 50, burn_in = 100, params = s1[[1]], initial_states = s1[[2]])# Plot the output in base R
plot(m6$Pig_Cysticercosis_prev*100 ~ m6$t, type="l", col="darkmagenta", ylim=c(0,30), ylab = 'prevalence (%)', xlab = 'time (months)')
lines(m6$Human_Cysticercosis_prev*100 ~ m6$t, type="l", col="deeppink")
lines(m6$Human_Taeniasis_prev*100 ~ m6$t, type="l", col="dodgerblue")
legend('topright', c('porcine cysticercosis', 'human cysticercosis', 'human taeniasis'), lty = c(1, 1, 1),
col=c('darkmagenta', 'deeppink', 'dodgerblue'))The user should note that the model has been updated to include a pre-patent period in pigs given that pigs are generally slaughtered within 6-36 months of age, and the pre-patent period (time from oncosphere/egg exposure to developing a mature larval-stage infection) is 2-3 months, so this is a non-negligible time period compared to the life-expectancy of the pig. Therefore, the pre-patent period should be included in the model.
Guidance for modelling interventions in age-structured EPICYST can be found in the next vignette: