X-xde-workhorse.Rmd
suppressMessages(library(knitr))
suppressMessages(library(ramp.xds))
#suppressMessages(library(ramp.library))
library(deSolve)
library(ramp.library)
#devtools::load_all()
Warning: workhorse
is in
development.
In the following, we present a stage of infection (SoI) model for malaria infection that recognizes an important difference between the two major phases of an infection: the acute phase characterized by geometrically increasing parasite numbers; and the chronic phase characterized by fluctuating parasite densities. The model explicitly considers superinfection, which moves individuals from an infected state into a parallel set of states.
Uninfected individuals are either susceptible to infection U or chemoprotected and not susceptible to infection.
Some recently treated, chemoprotected individuals remain infectious G. The remainder are chemoprotected and not infectious, P.
There are four chronic infection stages: I1,I2,I3 and I4 .
There are five acute infection stages: four (A1,A2,A3,A4) that correspond to an acute-phase infection concurrently infected with parasites in the chronic phase; and one (A0) that corresponds to carrying an acute phase infection but being otherwise uninfected.
All acutely infected individuals transition into I1
The variables are thus:
U
Chemoprotected states are P and G
Acute stages of infection: A0,A1,A2,A3,A4
Chronic stages of infection: I1,I2,I3,I4
These are:
r - the rate of recovery from infection
σ - treatment rate
hτ - rate at which immunity is acquired
ζU - rate at which chemoprophylaxis is administered to uninfected individuals
ζA - rate at which chemoprophylaxis is administered to individuals in acute phase of infection
ϕ - rate at which individuals in acute phase move into chronic stage of infection
ζi,i=1,2,3,4 - rate at which individuals in chronic stages of infection obtain chemoprophylaxis
p(w) - the peak of infection
ξi,i=1,2,3,4 - rate at which individuals move through the different chronic stages of infection
δI - rate of loss of immunity
Active acute-phase infections become apparent after τ days, and:
Uninfected
dUda=r∑iIi+σ(P+G)−(hτ+ζU)UdA0da=r∑iAi+hτU−(ϕ+ζA+ζU)A0Chemoprotected
We are assuming that treatment as a result of an acute infection could leave a person infectious:
dPda=ζU(U+A0)+∑i≥2ζiIi−σPdGda=ζ1I1+ζA∑iAi−σG
Infected
Where ϕ is on the order of 1/10d and
At peak:
dI1da=p(w)ϕ∑iAi−(hτ+r+ξ1+ζ1)I1dI2da=(1−p(w))ϕ∑iAi+ξ1I1−(hτ+r+ξ2+ζ2)I2dI3da=ξ2I2−(hτ+r+ξ3+ζ3)I3dI4da=ξ3I3−(hτ+r+ζ4)I4
Past peak, for n∈2,3,4:
dA1da=hτI1−ϕA1−(ζA+r+ζ1)A1dAnda=hτIn−ϕAn−(ζA+ζn)InImmune Tracking
dw0da=hτdwida=hτ−δIwi
#devtools::load_all()
wh <- xds_setup(dlay = 'dde',
Xname = "workhorse",
HPop=1000,
Lname = "trivial",
Lopts = list(
Lambda = 3000,
season = function(t){1+sin(2*pi*t/365)}
)
)
wh <- xde_solve(wh, Tmax = 5*365, dt=10)
wh1 = wh
wh1$Xpar[[1]]$zeta_1 = 0.02
wh1 <- xde_solve(wh1, Tmax = 5*365, dt=10)
xds_plot_X(wh)
xds_plot_X(wh1, llty=2, add=FALSE)
time = wh$outputs$time
with(wh$outputs$orbits$XH[[1]],{
A = A0+A1+A2+A3+A4
I = I1+I2+I3+I4
plot(time, U + P + G, type = "l", ylim = range(0, H), col = "darkblue")
lines(time, A+I, col = "darkred")
lines(time, A, col = "purple")
lines(time, I-I1, col = "orange")
lines(time, P+G, col = "darkgreen")
})
with(wh1$outputs$orbits$XH[[1]],{
A = A0+A1+A2+A3+A4
I = I1+I2+I3+I4
lines(time, U + P + G, col = "darkblue", lty=2)
lines(time, A+I, col = "darkred", lty=2)
lines(time, A, col = "purple", lty=2)
lines(time, I-I1, col = "orange", lty=2)
lines(time, P+G, col = "darkgreen", lty=2)
})