# What's the most pain-free way to fit logistic growth curves in R?

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 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.

-
 There are several ways you might do it, but the built-in nls is probably the best way. It has a built-in self start function for the logistic curve, which means you don't need good starting values (as you would for some exotic curve without one). – Glen_b Jan 16 at 0:05

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

> library("nls")
> 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.

-