I'm trying to model the COVID-19 pandemic in Madrid during the first wave, to model the data I'm using the SIR model. The SIR model stands for suceptible, infected and recovered. It is a compartmental model meaning that it puts each person in one of the comparments and it models how each individual moves between the compartments.
The model is based on a system of ODE's with two parameters "a" and "b". The system is the following:
$\frac{dS}{dt}=-bsi$ (1)
$\frac{dI}{dt}=bsi-ai$ (2)
$\frac{dR}{dt}=ai$ (3)
I have the data for the active cases each day (Infected compartment) and i'm trying to numerically obtain the value for the parameter "b" (I already know "a"). Perhaps the least squares method could work to estimate the values but I'm not sure how I could apply it here.
The main method i've used (but has not worked) is solving the ODE implicitly. By diving equation (2) by equation (1) you end up with a solution for i(t) in terms of S(t).
$i=i(t)=\frac{a}{b}ln(s(t))-s(t)-i(0)-\frac{a}{b}ln(s(0))+s(0)$
From here you can express the value of "b" in terms of s(t) and i(t)
$b=\frac{aln(\frac{s(t)}{s(0)})}{i(t)+s(t)+i(0)-s(0)}$
And since I have the data for s(t) and i(t) I calculated the value of "b" for all the different days in the first wave and I calculated the mean of these values, however the model doesn't corectly fit the data with the mean parameter that I obtained.
