Я пытаюсь найти значение R0, которое сейчас не известно. Я реализовал модель SIR путем подбора кривой и получил возможные значения бета и гамма . Теперь я хочу получить возможное значение R0 с помощью подгонки кривой или любым другим возможным способом, которым будет оценена любая помощь.
Где R0 -
If R0 is less than 1, each existing infection causes less than one new infection.
If R0 equals 1, each existing infection causes one new infection.
If R0 is more than 1, each existing infection causes more than one new infection.
, это код SIR
def plot_sir(t, column_name, title):
from scipy import integrate, optimize
N = 10000000
inf0 = 1.0
sus0 = N - inf0
rec0 = 0.0
def sir_model(y, x, beta, gamma):
sus = -beta * y[0] * y[1] / N
rec = gamma * y[1]
inf = beta * y[0] * y[1] / N - gamma * y[1]
return sus, inf, rec
def fit_odeint(x, beta, gamma):
return integrate.odeint(sir_model, (sus0, inf0, rec0), x, args=(beta, gamma))[:,1]
popt, pcov = optimize.curve_fit(fit_odeint, t, column_name)
fitted = fit_odeint(t, *popt)
plt.plot(t, column_name, 'o')
plt.plot(t, fitted)
plt.title(title)
plt.ylabel("Population infected")
plt.xlabel("Days")
plt.show()
print("Optimal parameters: beta =", popt[0], " and gamma = ", popt[1])
** это показывает требуемый вывод как **
