MathGroup Archive 2006

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

Search the Archive

Re: Best linear Fit to slope data with Fixed starting point/value.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63554] Re: Best linear Fit to slope data with Fixed starting point/value.
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Thu, 5 Jan 2006 03:12:22 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

On 1/4/06 at 3:17 AM, lrebanks at netvigator.com (Lea Rebanks) wrote:

>Given the list below, (quite large - 4516 points), is when plotted
>an almost perfect straight line with noise.

>I want to plot the best linear fit (i.e. m*x + b) to this data,
>however I must retain the original first value (151.0993767999595).

>Obviously I could do this manually, but was wondering if there was
>a more accurate & efficient way using Mathematica.

<data snipped>

Using data to contain the values you posted, this problem can be solved as follows:

In[2]:= FindFit[data - First[data], m*x, m, x]
Out[2]= {m -> 0.058734079632062085}

In[3]:=model = m*x + First[data] /. %
Out[3]=0.058734079632062085*x + 151.0993767999595

That is by subtracting the first value from the list of values, the problem is transformed to an equivalent problem of finding the best fit through zero. Adding the first value back to the fitted model gives the desired fit through the first point.
--
To reply via email subtract one hundred and four


  • Prev by Date: Kernel hang during FindFit under 5.1 for Linux
  • Next by Date: Re: Re: Plotting an equation
  • Previous by thread: Best linear Fit to slope data with Fixed starting point/value.
  • Next by thread: Re: Best linear Fit to slope data with Fixed starting point/value.