2

I am trying to model the population growth of countries with the following logistic equation:

$$p(t) = \frac{P_oK}{P_0+(K-P_0)e^{(-rt)}}\tag{displayed}$$

Where $p$ = population; $P_0$ = initial population; $K$ = carrying capacity; $r$ = constant; and $t$ = time

I have the data of the population over time and a set carrying capacity. But I would like to know how to go about performing a regression with this function to best fit the all the data I have available.

Preface: I think I may be out of my depth here in the math required but I am very willing to try... and if nothing else it would at least satisfy my curiosity.

Thanks.

2 Answers2

1

You can conduct a linear regression. You just have to do some transformations. $$p(t) = \frac{P_oK}{P_0+(K-P_0)e^{-rt}}=\frac{K}{1+(\frac{K}{P_0}-1)e^{-rt}}$$

$$=\frac{1}{p(t)}=\frac{1+(\frac{K}{P_0}-1)e^{-rt}}{K}\Rightarrow \frac{1}{p(t)}=\frac{1}{K}+\frac{(\frac{K}{P_0}-1)e^{-rt}}{K}\Rightarrow \frac{1}{p(t)}-\frac{1}{K}=\frac{(\frac{K}{P_0}-1)e^{-rt}}{K}$$

$$\Rightarrow \frac{1}{p(t)}-\frac{1}{K}=\left( \frac{1}{P_0}-\frac{1}{K} \right) \cdot e^{-rt}$$

Taking logs

$$ln\left( \frac{1}{p(t)}-\frac{1}{K}\right) =rt+ln\left(\frac{1}{P_0}-\frac{1}{K} \right)$$

Transforming the values

$y=ln\left( \frac{1}{p(t)}-\frac{1}{K}\right)$ and $b=ln\left(\frac{1}{P_0}-\frac{1}{K} \right)$

It is possible to calculate the y-values, because you know p(t) for the corresponding t-value.

$y=r\cdot t+b$

callculus42
  • 30,550
  • If I may, since $K$ is known, you need to move the second logarithm from rhs to rhs and perform a linear regression with no intercept. – Claude Leibovici Aug 15 '15 at 14:15
  • @ClaudeLeibovici But is $P_0$ also known ? – callculus42 Aug 15 '15 at 14:38
  • You are totally correct and I am stupid !! – Claude Leibovici Aug 15 '15 at 14:59
  • Thank you for your response. Though I am a bit unsure now with the two answers as to what to do.

    Originally, my model did assume a $P_0$ value (but I can see the benefit in not doing this). Basically, if one of you could clarify:should I be performing a linear or non-linear regression? and which transformation should I be using? What are the differences?

    – Mr. Scarecrow Jack Aug 15 '15 at 15:42
  • @Mr.ScarecrowJack The is no need ot assume a value for $P_0$. The value will be estimated by the linear regression. You conduct a linear regression after you have transformed the data. An (arbitrary) example for one data point:If $p(1)=1$ and $K=2$, then $y(1)=ln \left( \frac{1}{1}-\frac{1}{2}\right)=ln\left( \frac{1}{2}\right)$. And $t=1$ remains $t=1$.This kind of transformation you do for all data points $(t/p(t))$ – callculus42 Aug 15 '15 at 16:07
  • Alright I am good to go! Thank you for your help @calculus – Mr. Scarecrow Jack Aug 16 '15 at 01:56
  • @Mr.ScarecrowJack You´re are welcome. – callculus42 Aug 16 '15 at 09:05
0

This is a typical nonlinear regression problem where the parameters $K$ and $r$ must be identified.

As usual, the problem is to have "good" starting values. Assuming that your data cover a wide range, there are a few things which can help you to get estimates.

The slope at the origin is $$P_0'=\frac{{P_0}\, r \,(K-{P_0})}{K}$$ On the other hand, the inflection point occurs at $$t_*=\frac{\log \left(\frac{{K-P_0}}{{P_0}}\right)}{r}$$

Using these two informations (visual estimates), you can eliminate $r$ from the second equation and solve numerically the first for $K$. At this point, you are ready to go for the nonlinear regression.

Edit

At the inflection point, you also have $P(t_*)=\frac K2$ which can be very helpful for an estimate of $K$.

Now, assume that this value is correct and rewrite $$\log \left(\frac{P (K-{P_0})}{{P_0} (K-P)}\right)=rt$$ from which you can deduce $r$ using a linear regression with no intercept.

For sure, all of the above assume that the inflection point belong to the data.

  • In my models, K has already been identified as part of other research. Though, if you would be able to point me in the right direction for a tutorial on non-linear regression which will work for my specific model that would be helpful. I did a brief google search and could only come up with exponenital models in the form $y=Ae^{bx}$ – Mr. Scarecrow Jack Aug 15 '15 at 09:11
  • If you have $K$, just perform the linear regression to get an estimate of $r$ (see my last edit). But, to be rigorous, you should continue with the nonlinear regression since what is measured is $P$ and not $\log \left(\frac{P (K-{P_0})}{{P_0} (K-P)}\right)$ – Claude Leibovici Aug 15 '15 at 09:14
  • After a bit of googling. I think I am capable of performing the linear regression estimate. Thank you. In regards to the non-linear regression: doesn't $\log \left(\frac{P (K-{P_0})}{{P_0} (K-P)}\right)$ equal population anyway because we just algebraically manipulated it? (Once again, I love math but am not that great.) Also any resources you could point me to for non-linear regression (my research efforts have been futile). – Mr. Scarecrow Jack Aug 15 '15 at 09:39
  • https://en.wikipedia.org/wiki/Non-linear_least_squares. Come back if you need anything else. By the way, you can get $r$ immediately. – Claude Leibovici Aug 15 '15 at 14:21
  • Please see my comment on the other answer as well. Can you explain how I can get $r$ immediately. Do you mean by doing the regression? – Mr. Scarecrow Jack Aug 15 '15 at 15:44
  • 2
    I made a stupid mistake thinking (I don't know why !) that $P_0$ was given. Do what @calculus answered if you want to adjust it or what I suggested if you want to fix it. – Claude Leibovici Aug 15 '15 at 15:50