# Metapopulation SIR

Hi All,

I am wondering if there is any metapopulation SIR type example.

Thank you,
Zara

I am not aware of a tutorial with a metapopulation model, but one of the simplest cases would be a special case of general structured models where there’s a transmission term between two otherwise isolated SIR models:

    vector meta_SIR(real t, vector y, real beta, real gamma, int N)

real S1 = y;
real I1 = y;
real R1 = y;

real S2 = y;
real I2 = y;
real R2 = y;

vector dydt;

// meta population one
dydt = -(betaw/N) * S1 * I1 - (betab/N) * S1 * I2; // dS1/dt
dydt = (betaw/N) * S1 * I1 - (betab/N) * S1 * I2 - gamma * I1; // dI1/dt
dydt = gamma * I1; // dR1/dt

// meta population two
dydt = -(betaw/N) * S2 * I2 - (betab/N) * S2 * I1;
dydt = (betaw/N) * S2 * I2 - (betab/N) * S2 * I1 - gamma * I2;
dydt = gamma * I2;

return dydt;
}


You could assume all transmission happens at the same rate, or as it’s formulated above assume transmission at a within- (\beta_w) and between- (\beta_b) metapopulation rates. If you can formulate an ODE metapopulation model, it should be straightforward to write a function for in Stan language and use the solvers to implement the inference in Stan. The specific formulation has nearly endless possibilities (e.g. the density dependence, modulated by N, may also be better modeled as metapopulation-specific), so it’s a matter of specifying exactly how the metapopulations interact, but the Stan implementation is not qualitatively more complex than an unstructured SIR.

1 Like

Great! Thanks

1 Like