I have ~10.000 of vectors and I want to fit a sigmoid curve to each of them; in each case, I need to define starting parameters for fitting, so I want to find these parameters automatically. On stackexchange, there are discussed strategies of automatically finding starting values for non-linear models (one,two), but these discussions consider some specific cases such as fitting a gaussian. Are there general stratagies which can be applied to sigmoid curve too?

  • $\begingroup$ You've left some useful information out, e.g., is there a unit of time or frame associated with these ~10,000 vectors? Next, there are lots of ways to fit a sigmoid or diffusion curve to this information. Regrettably, most of the extant models assume a univariate time series for the underlying process. Are these vectors iid? Or can they be related to one another in some sort of panel data structure? If the latter, then there are options beyond fitting ~10,000 univariate "models." $\endgroup$ Oct 26, 2016 at 21:41

1 Answer 1


First I will say that it can be dangerous to assume a large number of unseen data sets have some particular parametric form (e.g. logistic), unless there are very particular constraints on the data (i.e. inherent to the data generation process).

That said, assuming you have a set of 2D points that are "approximately logistic" $$y\approx A+B\frac{1}{1+\exp\left[-\left(ax+b\right)\right]}\equiv f[x]$$ then to estimate the 4 parameters $a,b,A,B$ a simple approach might be a two-step process like the following. (For simplicity I will assume all parameters are positive.)

The idea is that the logistic curve has a middle "linear" section connecting left and right "flat" sections. A robust procedure would really need to consider which of these are present in the data ... but for simplicity let's say all 3 are always present.

First you must estimate the asymptotes, which can be done as $$f[-\infty]=A\approx{y_\min} \text{ , } f[\infty]=A+B\approx{y_\max}$$ (again ignoring robustness here ... really the $y$ data could fluctuate around the asymptotes, even if both are present).

Second, compute the "normalized data" $$z\equiv\frac{y-A}{B}$$ where $z\in[0,1]$ if using the estimates above. Then subsample all points with $z\in(0,1)$, i.e. exclude the endpoints (for robustness a tolerance could be used here perhaps). For these points you can estimate $a,b$ with a simply linear fit $$\mathrm{logit}[z]\approx ax+b$$ where logit is the inverse logistic function.

This would give rough estimates for $a,b,A,B$ that could be used to initialize your nonlinear optimization.

Update: I would add that it seems likely that your 10,000 curves are somewhat related. If this is the case, then it would be better to estimate initial parameters in "batch" if possible.

For example, if the asymptotic limits are roughly constant between different curves, then you could estimate $A$ and $B$ more robustly. I would probably try something like using the mean of the upper and lower 5% of the combined $y$ data.

This would allow you to account for instances where some curves do not contain both asymptotes. Then for each curve you can estimate the initial $a,b$ as above, using a logit-linear fit to points between the asymptotes.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.