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 UU or chemoprotected and not susceptible to infection.

  • Some recently treated, chemoprotected individuals remain infections G.G. The remainder are chemoprotected and not infectious, P.P.

  • There are four chronic infection stages.

  • There are five acute infection stages: four that correspond to an acute-phase infection concurrently infected with parasites in the chronic phase; and one that corresponds to carrying an acute phase infection but being otherwise uninfected.

  • All acutely infected individuals transition into I1I_1

Variables

The variables are thus:

  • UU

  • Chemoprotected states are PP and GG

Active acute-phase infections become apparent after τ\tau days, and:

Uninfected

dUda=riIi+σ(P+G)(hτ+ζU)UdA0da=riAi+hτU(ϕ+ζA+ζU)A0 \begin{array}{rl} \frac{dU}{da} &= r \sum_i I_i + \sigma (P + G) - (h_\tau + \zeta_U) U \\ \frac{dA_0}{da} &= r \sum_i A_i + h_\tau U - (\phi + \zeta_A + \zeta_U) A_0 \end{array} Chemoprotected

We are assuming that treatment as a result of an acute infection could leave a person infectious:

dPda=ζU(U+A0)+i2ζiIiσPdGda=ζ1I1+ζAiAiσG \begin{array}{rl} \frac{dP}{da} &= \zeta_U (U + A_0) + \sum_{i\geq 2} \zeta_i I_i - \sigma P \\ \frac{dG}{da} &= \zeta_1 I_1 + \zeta_A \sum_i A_i - \sigma G \\ \end{array}

Infected

Where ϕ\phi is on the order of 1/10d1/10 d and

At peak:

dI1da=p(w)ϕiAi(hτ+r+ξ1+ζ1)I1dI2da=(1p(w))ϕiAi+ξ1I1(hτ+r+ξ2+ζ2)I2dI3da=ξ2I2(hτ+r+ξ3+ζ3)I3dI4da=ξ3I3(hτ+r+ζ4)I4 \begin{array}{rl} \frac{dI_1}{da} & = p(w) \phi \sum_i A_i - (h_\tau + r + \xi_1 + \zeta_1) I_1 \\ \frac{dI_2}{da} & = (1-p(w)) \phi \sum_i A_i + \xi_1 I_1 - (h_\tau + r + \xi_2+ \zeta_2) I_2 \\ \frac{dI_3}{da} & = \xi_2 I_2 - (h_\tau + r + \xi_3 + \zeta_3) I_3 \\ \frac{dI_4}{da} & = \xi_3 I_3 - (h_\tau + r + \zeta_4) I_4 \\ \end{array}

Past peak, for n2,3,4n \in 2,3,4:

dA1da=hτI1ϕA1(ζA+r+ζ1)A1dAnda=hτInϕAn(ζA+ζn)In \begin{array}{rl} \frac{dA_1}{da} & = h_\tau I_1 - \phi A_1 - (\zeta_A + r + \zeta_1) A_1 \\ \frac{d A_n}{da} &= h_\tau I_n - \phi A_n - (\zeta_A + \zeta_n) I_n\\ \end{array} Immune Tracking

dw0da=hτdwida=hτδIwi \begin{array}{rl} \frac{d w_0}{da} &= h_\tau \\ \frac{d w_i}{da} &= h_\tau - \delta_I w_i \\ \end{array}

#devtools::load_all()
wh <- xds_setup(Xname = "workhorse", 
                HPop=1000,
                Lname = "trivial", 
                Lopts = list(
                  Lambda = 3000, 
                  F_season = function(t, phase=0, season_opts=list()){1+sin(2*pi*t/365)}
                  )
                )
wh <- xds_solve(wh, Tmax = 5*365, dt=10)
wh1 = wh 
wh1$Xpar[[1]]$zeta_1 = 0.02
wh1 <- xds_solve(wh1, Tmax = 5*365, dt=10)
xds_plot_X(wh)
xds_plot_X(wh1, llty=2, add_axes=FALSE)
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) 
})