Fitting data to a logistic function

436 Views Asked by At

I've spent my whole entire weekend struggling with this problem. If we are given a set of data and are asked to fit it into a logistic equation:

$\frac{dP}{dt} = bP(\frac{a}b-P)$, where a and b is asked to be identified.

So the general solution I'd found from doing partial fraction was $\frac{Ae^{at}a}{1+Ae^{at}b}$ which hopefully is correct since I spent so much time on it. :')

I then found what A was at the initial point by replacing in the $P(0) = 1329$, so $A = \frac{(1329)}{(a-1329b)}$

Then I used another datapoint $P(1)=1976.89$ and rearranged it so that it equals $A = \frac{1796.89}{ae^a-1769.89e^ab}$. However I got stuck there since I tried to let both equations equal to each other like so:

$\frac{1796.89}{ae^a-1769.89e^ab}=\frac{(1329)}{(a-1329b)}$

But I tried it and... really should have known that it was not going work. I was planning on using another datapoint but I don't know if it's possible to solve if it's in the format of $\frac{1796.89}{ae^a-1769.89e^ab}=\frac{(1329)}{(a-1329b)}$ = another long equation.

Kinda given up on it now since I wasted a weekend but how would you guys go about with this question.

1

There are 1 best solutions below

2
On

Supposing you have data in the form $D = \{\{t_1,p_1\},\{t_2,p_2\},\cdots,\{t_n,p_n\}\}$

as the logistic curve is

$$ p(t) = \frac{a e^{a(t+t_0)}}{1+b e^{a(t+t_0)}} $$

at each point we have a difference

$$ \delta_k(a,b,t_0) = p_k(1+b e^{a(t_k+t_0)})-a e^{a(t_k+t_0)} = p_k+(b p_k-a)e^{a(t_k+t_0)} $$

so we can build a total squared differences as

$$ E(a,b,t_0) = \sum_{k=1}^n\delta_k^2(a,b,t_0) $$

and then solve the fitting problem as a minimization one.

$$ \min_{a,b,t_0}E(a,b,t_0) $$