Re: NonlinearFit-Logistic Function-CalcCenter 3
- To: mathgroup at smc.vnet.net
- Subject: [mg60567] Re: NonlinearFit-Logistic Function-CalcCenter 3
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Tue, 20 Sep 2005 05:19:58 -0400 (EDT)
- References: <dgitnd$2e2$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Oddur Bjarnason wrote: > I thank Bob Hanlon and Valeri Astanoff for their prompt reply and am following their suggestions. > > Purely by chance I found a solution to the problem I had using CalcCenter 3 for nonlinear fitting of data to a logistic function. > > By fitting > > data2={{-0.08,0.05},{0.96,-3.19}, > {1.93,-6.4},{2.98,-10.32}, > {3.97,-11.8},{5.92,-13.98}, > {7.88,-14.12},{11.85,-15.34}, > {15.79,-14.61},{19.7,-15.43}, > {23.67,-15.83}}; > > by NonlinearFit[data2, -a/(1 + b*Exp[-c*t]), t, {a, b, c}] > > instead of > > NonlinearFit[data2, a/(1 + b*Exp[-c*t]), t, {a, b, c}] > > that is by changing the sign of a > > I obtained the function > > -14.917794621733984/(1 + 10.284628991516529*Exp[-1.0072061447043623*t] > > Presumably this method can also be used in Mathematica. > > I must admit that I have not as yet found out why this works. > > Regards, > > Oddur Bjarnason I have found the logistic function to be generally more tractable if it is parameterized using Log[b] instead of b: In[1]:= data2={{-.08,.05},{.96,-3.19},{1.93,-6.4},{2.98,-10.32}, {3.97,-11.8},{5.92,-13.98},{7.88,-14.12},{11.85,-15.34}, {15.79,-14.61},{19.7,-15.43},{23.67,-15.83}}; In[2]:= altexpr = a/(1 + Exp[d-c*t]); altparam = {a,d,c}; In[3]:= FindFit[data2, altexpr, altparam, t] FindFit[data2, altexpr, altparam, t, Method->QuasiNewton] FindFit[data2, altexpr, altparam, t, Method->Gradient] Exp[d/.%] Out[3]= {a -> -14.9178, d -> 2.33065, c -> 1.00721} Out[4]= {a -> -14.9178, d -> 2.33065, c -> 1.00721} Out[5]= {a -> -14.9178, d -> 2.33064, c -> 1.0072} Out[6]= 10.2845