MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FindFit power law problem

  • To: mathgroup at
  • Subject: [mg117243] Re: FindFit power law problem
  • From: Gary Wardall <gwardall at>
  • Date: Sat, 12 Mar 2011 05:11:00 -0500 (EST)
  • References: <ilcqal$iir$>

On Mar 11, 3:34 am, Bill Rowe <readn... at> wrote:
> On 3/10/11 at 6:06 AM, gward... at (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.

I stand in error. My statement of  "Some software transforms just the
y data when
estimating the coefficients for the model y = a*x^b" is not correct.

 It should have been:

" Some software transforms just the y data when
estimating the coefficients for the model y = a*b^x"

Greg is correct. With:

Fit[Log[10, data], {1, x}, x]

both the xdata and the ydata sets are transformed by a Log function is

The coefficients in theory be should close. In practice it's often
not. The least squares coefficients are a function of the data. The
data used in  FindFit[data, a x^b, {a, b}, x] and the data used in
Fit[Log[10, data], {1, x}, x] are not the same.

I apologize if my mistake added confusion.


  • Prev by Date: Re: Execute on notebook creation
  • Next by Date: Re: Contour line colors from z coord of a 3D plot
  • Previous by thread: Re: FindFit power law problem
  • Next by thread: results from Array and ParallelArray differ