MathGroup Archive 2011

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

Search the Archive

Re: FindFit power law problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117021] Re: FindFit power law problem
  • From: Darren Glosemeyer <darreng at wolfram.com>
  • Date: Tue, 8 Mar 2011 05:33:01 -0500 (EST)

On 3/7/2011 4:48 AM, Greg Childers wrote:
> Hi,
>
> I'm having a problem with FindFit and a power law problem.  Here's the data:
>
> data = {{1004, 0.003977}, {9970, 0.006494}, {100000, 0.012921},
> {1001000, .059795}}
>
> I'm wanting to fit it to a function of the form y = a x^b, and determine
> the best value of b.  When entered into Excel, it returns the exponent b
> = 0.383.  However, Mathematica gives
>
> FindFit[data, a x^b, {a, b}, x]
> {a->0.0000145749, b->0.601807}
>
> A graph of these values overlaid on the original data simply didn't look
> right.  Another way to find the exponent b is to take the log of both
> sides and do a linear fit:
>
> Fit[Log[10, data], {1, x}, x]
> -3.64936 + 0.383174 x
>
> And sure enough the exponent is 0.383 in agreement with Excel.  Why does
> FindFit give a different value?
>
> Greg
>

These are fitting different models. The errors (and hence the sum of 
squares to be minimized) in the two models are on different scales. The 
FindFit input fits the nonlinear model:

y = a*x^b + error

while the Fit input fits the transformed (linearized model):

Log[y] == a + b*Log[x] + error

Both cases solve a least squares problem (the error terms are both 
normally distributed), but the scale in which the sum of squares is 
minimized is different, so the results are different.

Darren Glosemeyer
Wolfram Research


  • Prev by Date: mathematica 6 saves notebook to an "empy" file
  • Next by Date: Re: Spacing of group of Line[]-s -- any simple way?
  • Previous by thread: FindFit power law problem
  • Next by thread: Re: FindFit power law problem