Skip to content
All library documents

Fitting Generalized Logistic Curves with Constraints and Solver Choices

Article Quant Q&A · Author: Joshua Ulrich

Summary

The document discusses unstable parameter estimates when fitting a generalized logistic curve with a nonlinear least-squares method. The parameters are usually near expected values, but occasionally the optimizer returns implausible estimates. The proposed remedies are to try different starting values or solvers and to constrain parameters to plausible ranges. One answer mentions Excel, Matlab, and R as options; another reports using Excel Solver with bounded variables and its nonlinear GRG method, minimizing the sum of squared errors.

The evidence is anecdotal: one contributor describes a fitting setup and its approximate runtime on 200 observations, without a systematic comparison of solvers or out-of-sample validation. Constraints can reduce implausible solutions, but their bounds need sound justification, and changing the solver does not guarantee a reliable fit. The discussion does not diagnose the cause of the bad estimates or establish that one method is generally superior.

Key ideas

  • Nonlinear fitting results can depend strongly on starting values.
  • Constraining parameters to plausible ranges may prevent implausible estimates.
  • The discussion suggests comparing solvers such as Excel Solver, Matlab, or R.
  • One contributor reports using bounded variables and Excel Solver’s nonlinear GRG method.
  • The solver recommendations are anecdotal and are not supported by a systematic comparison.

Tags

Full text
# Fitting a generalized logistic distribution


# Fitting a generalized logistic distribution












I have a process that estimates the parameters for the following function using the NL2SOL algorithm.

$C-[\alpha+\frac{\beta-\alpha}{1+e^-\theta(y_t-\delta)} \vartriangle y_t]$

The process currently holds $\alpha$ and $\beta$ constant, so only $C$, $\theta$, and $\delta$ are being estimated. The parameters are generally stable over time ($\delta \approxeq 5$, $\theta \approxeq 2$, and $C \approxeq 0$). The problem is that sometimes NL2SOL gives very poor estimates of these three parameters ($\delta > 100$, $\theta = 0$, $C=-1$).

I'm considering an ad-hoc solution that would re-estimate the parameters using new starting values and/or by setting $C$ to a constant. Before I do that, I wanted to ask this fine community: what might be causing these poor estimates and what action should I take? Should I use an algorithm other than NL2SOL?

## Answer by Samik R (score 6, accepted)

https://quant.stackexchange.com/a/2097

Nonlinear optimization algorithms are very susceptible to starting points, so some problems with same structure can become difficult to solve compared to others. A few suggestions:

- For a few instances where you are having difficulty in getting answers, try using another solver. You can try Excel, Matlab or R, all of which can be used for fitting.

- Try adding constraints to bind variables to specific ranges, e.g., -0.5 <= C <= 0.5, 1 <= theta <= 2 etc. You will have to switch to general purpose solvers which can accept constraints. Again, Excel, Matlab and R has those.

I think Excel might be the quickest to set up and test. You can try out a few instances where you know the answers, so that you are sure you are on the right track.

Another note: I can't say much for the specific algorithm you are using, but the Levenberg-Marquardt method is well-known in the fitting community.

Hope this helps. Good luck.

## Answer by Szymon (score 0)

https://quant.stackexchange.com/a/4811

I've been using Excel's Solver to fit the generalized logistic curve. I get the best results (best fit) when I: 1. Bind all the variables (upper and lower) 2. Use non-linear GRG.

On 200 observations it takes about a minute to estimate. The objective was minimising sum of squares (maximising R2).

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.