# Fitting Generalized Logistic Function

(Dominic DiCostanzo) #1

Hello, I started working with Math.NET and have run into a small problem I was hoping for some help in solving. I have a curve that I know the generalized logistic function will fit if of the form:

``````y(x) = 100 / (1 + (x/a)^b)^c
``````

I was able to fit the curve in Matlab with good results, but I wasn’t clear on the ability to linearize it or fit with a mixture of other potential functions. Any help or comments would be appreciated. Thanks in advance.

(Peter Vanderwaart) #2

A quick search reveals that there is quite a literature on fitting logistic functions. What’s best for you depends on a lot of factors such as are you just doing one case or many, how accurate you think you need to be, if you need descriptive statistics like Goodness of Fit, how much programming you want to do, etc.

I’m also new to Math.NET, and as a learning experiment I’ve been trying to fit a related but simpler equation. My painful progress is in the “How to use the optimization class” thread. The approach there is to program an error function of three variables and use a general minimum finder to find a good fit. So far, the results are mediocre, but I’m going to keep working on it for another step or two. I’ll be happy to provide the whole program if you think you need something not shown in the excerpts.

In your case, I would try to fit the inverted expression (1/y = …). Keep in mind that this transformation (or any transformation) will change the answer at least slightly. In the case of inversion, I doubt this is important.

An approach you can consider it is to create a program that finds the minimum for a fixed value of one of the variables, thus reducing the dimension of the problem by one. For example, if you think the value of c is about 2, then create a program that finds the minimum a & b for c=2. Once you have this program, you can run it for a range of values for c to figure out which is best. This approach could be automated by creating a min-over-c program that is a wrapper over the min-over-a_&_b program.

Estimate parameters Logistic function