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
Variablex//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] = K5return w[0]+((w[1]-w[0])/(1+w[2]*exp(-w[3]*(x-w[4])))^(1/w[5]))EndFunction Gompertz(w,x) : FitFunc
Wave w
Variablex//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] = K2return w[0]*exp(w[1]*exp(w[2]*x))End
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
Variablex//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 returnstatsLogisticCDF(x,w[0],w[1])End
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.
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
December 22, 2020 at 10:35 pm - Permalink
Hi Steve,
Thank you for the fit functions. Curious any best practices for generating initial estimates for the parameters?
Andy
December 23, 2020 at 08:05 am - Permalink
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

December 23, 2020 at 09:32 am - Permalink
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
December 23, 2020 at 10:44 am - Permalink