Re: FindFit power law problem
- To: mathgroup at smc.vnet.net
- Subject: [mg117200] Re: FindFit power law problem
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Fri, 11 Mar 2011 04:34:01 -0500 (EST)
On 3/10/11 at 6:06 AM, gwardall at gmail.com (Gary Wardall) wrote: >I was wondering if you really meant to transform both the x and y >data? >Fit[Log[10, data], {1, x}, x] >Does just that. Some software transforms just the y data when >estimating the coefficients for the model y = a x^b. >What happens is they transform just the y data and use the linear >model >yy=aa+bb*ln[x] >Finding the coefficients aa and bb and state the results as >y=Exp[aa]*x^bb >Since: > >y=Exp[aa+bb*ln[x]] >is equivalent to: >y=Exp[aa]*Exp[bb*ln[x]] >in turn is equivalent to: >y=Exp[aa]*Exp[ln[x^bb]] >which is also equivalent to: >y=Exp[aa]*x^bb >Note then that a=Exp[aa] and b=bb. >I hope my Algebra is correct. Your algebra looks right. However,... You start you post by asking about transforming both x and y. You have a model where you transform y then seem to be suggesting to do: FindFit[xformedData, a Log[x] + b, {a,b}, x] This is exactly the same as doing FindFit[Log[data], a + b x, {a,b},x] That is setting up the model as a linear function of Log[x] is exactly the same as transforming both x and y then using a linear model to fit the transformed data. Note also, the difference in fit parameters comes about by transforming y. For real data, errors are almost always additive. Any non-linear transformation of measured y data with additive error creates a fundamentally different model. The point is f[y+error] does not map to f[y] + f[error] unless f is a linear function. If the range for you data isn't too large, doing a non-linear fit to the data will give approximately the same result as doing a linear fit to appropriately transformed data. A sufficiently small range in this context means the deviation from true linearity is small. Or said differently, any non-linear function restricted to a sufficiently small range looks linear.