(Tag suggestions welcome, I was looking for 'logistic-growth' or 'sigmoid-growth' but those tags don't exist)
I'm working through an exercise on this online textbook, 'Try it #3', almost halfway down the page.
Table 6 shows the population, in thousands, of harbor seals in the Wadden Sea over the years $1997$ to $2012$. \begin{array}{|c|c|c|c|} \hline \text{Year}& \text{Seal Population (Thousands)} &\text{Year} & \text{Seal Population (Thousands)} \\ \hline 1997 & 3,493&2005&19,590 \\ \hline 1998 & 5,282&2006&21,955\\ \hline 1999 & 6,357&2007&22,862\\ \hline 2000 & 9,201&2008&23,869\\ \hline 2001 & 11,224&2009&24,243\\ \hline 2002 & 12,964&2010&24,344\\ \hline 2003 & 16,226&2011&24,919\\ \hline 2004 & 18,137&2012&25,108\\ \hline \end{array}
(a) Let $x$ represent time in years starting with $x=0$ for the year $1997$. Let $y$ represent the number of seals in thousands. Use logical regression to fit a model to this data.
(b) Use the model to predict the seal population for the year 2020.
(c) To the nearest whole number, what is the limiting value of this model?
I would like to attempt this with a custom function in R. Here's the same data as part of a data frame:
ti3_df <- data.frame(
x = 0:15,
y = c(3.493, 5.282, 6.357, 9.201, 11.224, 12.964, 16.226, 18.137,
19.590, 21.955, 22.862, 23.869, 24.243, 24.344, 24.919, 25.108)
)
The textbook says that the logistic function is:
$$y=\frac{c}{1+ae^{-bx}}$$
I know that C is the carrying capacity or upper limit. But this is not provided in the question. I don't know if it's actually possible to solve this manually using the formula approach since I'm fitting a curve aka 'modeling' the data rather than calculating an exact point.
The books says 'The initial value of the model is $\frac{c}{1+a}$'
I wanted to build a function of the form:
my_log_growth_func <- function(c, a, dataframe) {... r code here}
Where I would calculate b
and x
. But I think I'm missing something and am unsure if it's possible to fit a model using the information I have without a calculator or package.
How can I fit a model to these data?