This vignette relies on software developed for RAMP Simulation-Based Analytics (see SimBA)
Pseudo-Data
Suppose we have data describing PfPR and we have case data from facilities. From these two signals, we think the PfPR over the last six years looks something like this,
set.seed(23)t =c(0:6)*365tt =seq(0, 6*365, by =30)y =c(0.27, .28, .32, .15, .13, .18, 0.23)seas =sin(2*pi*(tt-120)/365)*.03trend =spline(t, y, xout=tt)$ynoise =rnorm(length(tt), 0, .3*y)^2signal = trend+seas+noiseplot(tt, signal, type ="l", ylim =c(0, 0.45), xlab ="time", ylab ="trend", lwd=2)lines(tt, trend, col ="darkred")points(t,y)
#segments(950, 0, 950, 0.4, col = "sienna", lwd=2)#segments(1315, 0, 1315, 0.4, col = "sienna", lwd=2)
Setting up a model
We start by making assumptions about the model for infection and immunity, about some aspects of seasonality, and etc.
We would like to start with a simple model. We use ramp.xds and we want to use the SIP module from ramp.library. We will also need some functions from ramp.work
Each model asks us to make some assumptions about the parameters affecting malaria infection and immunity, including drug taking. The SIP model is explained in the documentation:
Xo =list(xi=2/365, rho=0.1)
Seasonality
We need to make some kind of assumption about the form for seasonal exposure to the EIR. We’ll adjust the phase in a bit, but for now, we’re going to specify the shape. This is explained in the documentation for make_function.sin in ramp.xds(offsite).
The following shows the scaling relationship and the fitted point.
plot_eirpr(mod0)with(eirpr0, points(365*eir, pr))
This gives us an annual EIR value:
eirpr0$eir-> eir0eir0*365
[1] 2.728068
Now, we have a model that outputs a time series that has the right mean.
mod0 <-set_eir(eir0, mod0) mod0 <-xds_solve_cohort(mod0, A=3)mod0 <-last_to_inits(mod0) mod0 <-xds_solve_cohort(mod0, A=7)XH <-get_XH(mod0)with(XH, plot(time, true_pr, type ="l", ylim =c(0,0.45), col ="darkred"))lines(tt, signal)
Phase Matching
An easy way to get the phase right is to compare the phase in data to the phase of the simulation.
ramp.work has a function called mean_phase_peak that computes the average peak. In the pseudo-data I generated, malaria peaks around the 210^{th} day of the year: