# 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?

-
Assuming that you're recalculating the Jacobian Matrix over and over, have you watched the Jacobian to see if it has any spikes or unstable swings from positive to negative? If so, you might look into "clamping" the matrix values to be within reasonable ranges. – bill_080 Sep 30 '11 at 17:46
I was looking at the partials in the following link, trying to set up a Jacobian, and noticed some differences in the form of your equation and their equation. Is there a reason for the differences (for example, the 1/v term)? en.wikipedia.org/wiki/Generalised_logistic_function – bill_080 Sep 30 '11 at 19:18
@bill_080: we're simply holding some terms constant at 1 (e.g. $v=1$ and $Q=1$). Sorry I didn't mention that in my question. – Joshua Ulrich Sep 30 '11 at 19:27

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:

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

-
Thanks for your suggestions; I tried both. Using constraints caused an edge-case segfault in the NL2SOL optimizer I was using. A global optimizer (differential evoloution via DEoptim in R) produced different parameter estimates, but similar function values. So, the real answer to my question is that the functional form is incorrect in the cases where the estimates are "poor". – Joshua Ulrich Nov 15 '11 at 19:11

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

-
I don't think he'll be willing to be using excel. – SRKX Dec 21 '12 at 3:16
OK. Maybe someone else will find this thread useful as I did :) Another thing: it's good to set multistart option "on" - it's less susceptible to starting points. – Szymon Dec 21 '12 at 12:04