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 .+ exp.(-p.*(x.-p))) ## logistic equation for REGRESSION # regression # Sp. A x = col_x y = col_y par = [col_y, 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 # growth rate Sp. A # Sp. B x = vin_x y = vin_y par = [vin_y, 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 # 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 = species A sensible du = species A infected du = species B du = phages =# N = u + u + u # total bacteria ρ = 1 - N/κ # logistic term du = (μ*u*ρ) - (δ*u*u) - (ω*u) du = (μ*u*ρ) + (δ*u*u) - (η*u) - (ω*u) du = (ν*u*ρ) - (ω*u) du = (η*β*u) - (δ*u*u) - (λ*u) - (ω*u) 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, 0, vin_y, 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
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