Logistic Growth Curves – How to Fit Logistic Growth Curves in R with Minimal Effort

curve fittinglogistic-curvenonlinear regressionr

This isn't as easy to Google as some other things as, to be clear, I'm not talking about logistic regression in the sense of using regression to predict categorical variables.

I'm talking about fitting a logistic growth curve to given data points. To be specific, $x$ is a given year from 1958 to 2012 and $y$ is the estimated global CO2 ppm (parts per million of carbon dioxide) in November of year $x$.

Right now it's accelerating but it's got to level off at some point. So I want a logistic curve.

I haven't found a relatively straightforward way to do this yet.

Best Answer

See the nls() function. It has a self starting logistic curve model function via SSlogis(). E.g. from the ?nls help page

DNase1 <- subset(DNase, Run == 1)
      
## using a selfStart model
fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), 
                  DNase1)

I suggest you read the help pages for these functions and probably the linked references if possible to find out more.

Related Question