# Modelling COVID-19 in Julia and plotting AgentBasedModels on arbitrary networks

Hi all!

Recently there was a paper introducing Pathogen.jl, which I found interesting. It is a Julia package for modelling disease spreading : https://arxiv.org/abs/2002.05850

One can also use DifferentialEquations.jl to model disease spreading, as mentioned in the article.

But one can also do Agent based modelling of disease spreading, so motivated by the recent situation, we also did a “toy model” for COVID19 in Agents.jl: https://juliadynamics.github.io/Agents.jl/dev/examples/sir/

In doing so, we extended Agents.jl’s plotting capabilities to be able to plot any agent based model that is defined on any arbitrary network. It is still rough around the ages so let us know if you use it and how to improve it.

19 Likes

Thank you for putting this model together. I have found it very useful and interesting.

I have a question and a comment. First, how would you examine the effect of an intervention at different time steps, such as social distancing? Would you add a `model_step!` function that adjusts the parameters after a specified number of steps to implement the intervention?

I think there might be an error in the death rate calculations in `recover_or_die!`. The line `≥` in the line `if agent.days_infected ≥ model.properties[:infection_period]` should be changed to `=`. Otherwise, the patient will continue to die with the same probability after recovering.

Alternatively, you could find a uniform probability of death across the infection period like so:

``````1-(1-p)^N = .02
p = - 0.98^(1/N) + 1
``````

Edit: I thought there was an error because the death rate in the results was higher than the nominal death rate of 2%. It exceeded 2% because of the reinfection probability > 0. So there is no error.

1 Like

which version of Agents.jl is necessary here? I Cannot get the cenGraph type right.
Agents 2.4.0 here

I got: `LoadError: UndefVarError: GraphSpace not defined`
EDIT: solved by adding `Agents#master`

On my system, it works with Agents 2.4 and AgentsPlots 0.2.1 .

Thankyou. Agents#master ixes things for me

Exactly. This one of the main scenarions `model_step!` targets.

Notice that we are also working on a social distancing model in continuous space that will be published soon!

1 Like

@johnh , sorry, I posted a link to the development version of the docs, instead of the stable (that was stupid of me). If you look at the stable version of the docs (select it from the bottom of the sidebar), the example there has different code that indeed works with the stable releases.

1 Like

Thankyou @datseris please do not say sorry. This is important work you are doing.

1 Like