Logistic fit of data set

Hi,

I am interested in doing some logistic fits to some data. Anyone have a starting point on how to do it?

TIA

Andy

Hi Andy, your question prompted me to dig out these FitFuncs from 8 years ago. As I remember it, the built-in logistic functions are symmetrical whereas the generalised logistic function and the Gompertz version of it can be more useful. I've not used since then though, so beware!

Steve

Function Richards(w,x) : FitFunc
    Wave w
    Variable x

    //CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will
    //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog.
    //CurveFitDialog/ Equation:
    //CurveFitDialog/ f(x) = K0+((K1-K0)/(1+K2*exp(-K3*(x-K4)))^(1/K5))
    //CurveFitDialog/ End of Equation
    //CurveFitDialog/ Independent Variables 1
    //CurveFitDialog/ x
    //CurveFitDialog/ Coefficients 6
    //CurveFitDialog/ w[0] = K0
    //CurveFitDialog/ w[1] = K1
    //CurveFitDialog/ w[2] = K2
    //CurveFitDialog/ w[3] = K3
    //CurveFitDialog/ w[4] = K4
    //CurveFitDialog/ w[5] = K5

    return w[0]+((w[1]-w[0])/(1+w[2]*exp(-w[3]*(x-w[4])))^(1/w[5]))
End

Function Gompertz(w,x) : FitFunc
    Wave w
    Variable x

    //CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will
    //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog.
    //CurveFitDialog/ Equation:
    //CurveFitDialog/ f(x) = K0*exp(K1*exp(K2*x))
    //CurveFitDialog/ End of Equation
    //CurveFitDialog/ Independent Variables 1
    //CurveFitDialog/ x
    //CurveFitDialog/ Coefficients 3
    //CurveFitDialog/ w[0] = K0
    //CurveFitDialog/ w[1] = K1
    //CurveFitDialog/ w[2] = K2

    return w[0]*exp(w[1]*exp(w[2]*x))
End

 

Hi Steve,

 

Thank you for the fit functions.  Curious any best practices for generating initial estimates for the parameters?

Andy

Hi All,

Following the lead from Steve, I created the following fit function taking advantage of the builtin stats function.  To test things out I am using some sample data from JMP and I am getting a similar fit to the analysis from JMP.  I just have to rationalize the difference in the fit coefficients. Note: JMP does scatter plotting of the data for visual purposes.  I can replicate that later.

Andy

Function Logistic_fit(w,x) : FitFunc
    Wave w
    Variable x

    //CurveFitDialog/ These comments were created by the Curve Fitting dialog. Altering them will
    //CurveFitDialog/ make the function less convenient to work with in the Curve Fitting dialog.
    //CurveFitDialog/ Equation:
    //CurveFitDialog/ f(x) = 1/(1+exp(-(x-a)/b))
    //CurveFitDialog/ End of Equation
    //CurveFitDialog/ Independent Variables 1
    //CurveFitDialog/ x
    //CurveFitDialog/ Coefficients 2
    //CurveFitDialog/ w[0] = a
    //CurveFitDialog/ w[1] = b
 

    return statsLogisticCDF(x,w[0],w[1])
End

 

Hi,

Rationalized the differences in the coefficients.  In JMP the exponential is -(B*x -A) and IP it is -(x-a)/b and when rearranged the match to ~10% which is reasonable for an exponential fit.

Andy