I'm working through some textbook exercises on fitting models to data, including exponential, logarithmic and now logistic regression.
About a 3rd of the way down this page is the section on logistic regression. Using a model of the form $y=\frac{c}{1+ae^{-bx}}$ we have to fit a logistic model.
I'm using R and any searching for logistic regression in r returns results about binary classification whereas here I'm seeking a numerical result based on a logistic curve.
For the 'try it' exercise #3 on the page I linked to above, a data frame is provided:
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)
)
Along with the question:
Let x represent time in years starting with x=0 for the year 1997. Let y represent the number of seals in thousands. Use logistic regression to fit a model to these data.
How can I do this in R?
(Incase someone asks, 'why not just write a custom function based on the model definition above?', I would like to and that's what I'm building to because I don't fully understand how to do that 'by hand' at this stage. My initial goal is to get a result with an out of the box function in r before trying to recreate it myself with a custom function)