Hello,
I have been modeling some data of bacterial growth. I have first run a regression model to obtain the growth rates of the two species of the consortium. I then need to run some ODEs using logistic growth; these are biologically matched to the context. While the regression works, the ODE does not. I was expecting that the regression would have given me the best parameters for the ODE, as evident in this figure:
However, the regression and the ODE model do not use exactly the same formulae. Is it possible to modify the regression formula to match the ODE model? Or is it a trick to find the best parametrs for an ODE modeling?
This is the code I have written.
vin_x = [0.0, 6.465599999999999, 12.544800000000002, 24.0, 29.107200000000002, 45.772800000000004, 53.392799999999994, 68.0616]
vin_y = [1.434628836798e8, 1.318375623746e8, 1.108524843855e8, 6.91176196241e7, 4.19137382458e7, 1.48676444645e7, 1.00659726053e7, 7.8734512643e6]
col_x = [0.0, 5.5296, 11.827200000000001, 24.0, 28.627200000000002, 32.916, 40.4928, 48.0, 52.4952, 67.0968]
col_y = [8.02511788606e7, 9.98481296252e7, 2.328332483329e8, 6.148181496526e8, 9.453171952624e8, 1.2331292887706e9, 1.4394296796998e9, 1.460066157955e9, 1.3570403824485e9, 1.4269447174002e9]
model = true_logistic(x, p) = p[1] ./ (1 .+ exp.(-p[2].*(x.-p[3]))) ## logistic equation for REGRESSION
# regression
# Sp. A
x = col_x
y = col_y
par = [col_y[1], 0.0, 1.0]
fit = curve_fit(model, x, y, par)
P_col = fit.param
Vtl_col = true_logistic(x, P_col)
mu = P_col[2] # growth rate Sp. A
# Sp. B
x = vin_x
y = vin_y
par = [vin_y[1], 0.0, 1.0]
fit = curve_fit(model, x, y, par)
P_vin = fit.param
Vtl_vin = true_logistic(x, P_vin)
nu = P_vin[2] # growth rate Sp. B
# ODEs
function F_logistic!(du, u, p, t) # LOGISTIC model
Ī¼, Ī½, Ī», Ī“, Ī², Ī·, Īŗ, Ļ = p
#=
p = max growth rate A & B, outflow, adsorption rate,
burst size, lysis rate, carrying capacity, outflow
du[1] = species A sensible
du[2] = species A infected
du[3] = species B
du[4] = phages
=#
N = u[1] + u[2] + u[3] # total bacteria
Ļ = 1 - N/Īŗ # logistic term
du[1] = (Ī¼*u[1]*Ļ) - (Ī“*u[1]*u[4]) - (Ļ*u[1])
du[2] = (Ī¼*u[2]*Ļ) + (Ī“*u[1]*u[4]) - (Ī·*u[2]) - (Ļ*u[2])
du[3] = (Ī½*u[3]*Ļ) - (Ļ*u[3])
du[4] = (Ī·*Ī²*u[2]) - (Ī“*u[2]*u[4]) - (Ī»*u[4]) - (Ļ*u[4])
end
omega = 0.2
kappa = 1.5*10^9
delta = 5*10^-10
tau = 23
eta = 1/(tau/60)
lambda = 0.068
beta = 150.0
v0 = 0
u0 = [col_y[1], 0, vin_y[1], v0] # S, I, R, V
parms = [mu, nu, lambda, delta, beta, eta, kappa, omega]
tspan = (0.0, maximum(df.X)*24)
prob = ODEProblem(F_logistic!, u0, tspan, parms)
soln = solve( prob, AutoVern7(Rodas5()) )
Essentially, I tried to change true_logistic
into F_logistic
adding the logistic term to the former, but then even the regression does not work.
How can I get the best parameters for F_logistic
?
Thank you