epirecipes / sir-julia

Various implementations of the classical SIR model in Julia
MIT License
196 stars 39 forks source link

Wrong compartment plotted in ude.md and psm.md #68

Open SirLukeSchande opened 2 years ago

SirLukeSchande commented 2 years ago

I just noticed that the cumulative number of new daily cases $C$ is plotted instead of the recovered $R$ in both ude.md as well as psm.md.

The error is minor. A possible fix is

prob_psm_fit = ODEProblem(sir_psm, u0, tspan, res_psm.minimizer)
sol_psm_fit = solve(prob_psm_fit, solver, saveat = δt)
scatter(sira_sol, vars = (0,[1,2]), label=["True Susceptible" "True Infected"],title="Fitted partially specified model")
scatter!(sira_sol.t, t -> 1 - sum(sira_sol(t)[1:2]), label = "True Recovered")
plot!(sol_psm_fit, vars = (0,[1,2]), label=["Estimated Susceptible" "Estimated Infected"])
plot!(sol_psm_fit.t, t -> 1 - sum(sol_psm_fit(t)[1:2]), label = "Estimated Recovered")
Plots.vline!([train_time],label="Training time")