Re: fitting problem... iteration??
- To: mathgroup at smc.vnet.net
- Subject: [mg42228] Re: fitting problem... iteration??
- From: Bill Rowe <listuser at earthlink.net>
- Date: Tue, 24 Jun 2003 01:27:16 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
On 6/23/03 at 5:49 AM, ce.choa.phen.kee at philips.com wrote: > I managed to come out with the equation which i used to plot the curve, > providing that i fit the data points using NonlinearFit [data , ( A * Exp [ 1/ (wx) ] ) / ( B - x )^2 , { x , 1 / ( > wx ) } , { {A ,3} , {B , 600} } ]. I specified a certain value for the A and B, whose values were what I > got from MS Excel, I am able to get the correct equation as comparing to > Excel equation. But I do not want to use MS EXcel due to certain > constraints to fit such a complicated equation. > However, if I used this function: NonlinearFit [data , ( A * Exp [ 1/ (wx) ] ) / ( B - x )^2 , { x , 1 / ( > wx ) } , { A , B } ] without specifying the value, I got another equation. > May I know if this is regarding the iteration which Mathematica use to fit > or is it that there are many minima in the equation?? Most likely there are several minima. This is usually the case. One way to check for this would be to create a function to compute the correlation coeficient for 1/(B - x)^2 vs y. i.e., <<Statistics` r[x_List,y_List,B_] := Correlation[1/(B - #)^2&/@x, y]^2 Then do Plot[r[x, y, B], {B, Bmin, Bmax}]; The correlation coefficient sqaured will be a maximum whenever the sum of squares of the residuals in the regression problem is a minimum. This works because the correlation coeficient is scale independent. In your model the factor A*Exp[1/wx] sets the scale. I've taken wx to be a known constant It appears the factor A * Exp[1/wx] is a constant in your model. If so, your problem can be re-cast as a series of linear regression problems. Select one of the y values and divide all of the y values by this value. That will eliminate the factor A * Exp[1/wx] from the y data. Then B can be found by doing a linear regression on the data points {x, 1/ynew} using either Fit with the basis functions {1, x, x^2} or better PolynomialFit Once B is found, 1(B - x)^2 can be computed. Then Fit can be used to do a linear regression of this versus the original y data using the basis function {x Exp[1/wx} to find A. > Is there any way of getting the correct equation while not specifying the > value for A and B? What do you define as "the correct equation"?