How to calibrate age-structured SIR model on mono-dimensional data?

Consider the following age-structured SIR model I’ve written in the DifferentialEquations.jl framework:

# Import 
using DifferentialEquations, DiffEqBayes

# Model parameters
β = [0.1, 0.2, 0.3]
γ = 0.15
𝒫 = vcat([β, γ]...)

# Initial conditions
S₀ = [0.99,0.99,0.99]
I₀ = [0.01,0.01,0.01]
R₀ = [0.0,0.0,0.0]
ℬ = [S₀ I₀ R₀] 

# Time 
𝒯 = (0.0,100);    

# Model
function Φ!(du,u,p,t)
    m = size(u,1)
    β = @view p[1:m]
    γ = p[m+1]
    
    S = @view u[:,1]
    I = @view u[:,2]
    R = @view u[:,3]
    
    dS = @view du[:,1]
    dI = @view du[:,2]
    dR = @view du[:,3]
    
    @. dS = -β*S*I
    @. dI = β*S*I-γ*I
    @. dR = γ*I
end

# Problem Definition
problem = ODEProblem(Φ!, ℬ, 𝒯, 𝒫)

# Problem Solution
solution = solve(problem);

I need to calibrate the model with age-aggregated data for the recovered compartment using the ABC rejection method via the interface provided by the DiffEqBayes.jl package. I was thinking about something along the lines of

# Observation times
t = collect(1.:100.)   

# Priors array
priors = [Normal(1.5, 1),Normal(1.5, 1),Normal(1.5, 1),Normal(1.5, 1)]
results=  abc_inference(problem, Tsit5(), t, R_real_data, priors)

How can I run the ABC method on only one of the dimensions of solution object (i.p. distance between simulated age-aggregated R data vs. real age-aggregated R data)?

2 Likes

Use save_idxs on the ODE integrator so that it only saves that values you want to compare. For example:

results=  abc_inference(problem, Tsit5(), t, R_real_data, priors,save_idxs=[1,2])

will pass that down to the integrator and thus it will only output a timeseries of the first two states of the ODE, and thus only use those to compare to the underlying data.

3 Likes