Re: Best linear Fit to slope data with Fixed starting point/value.
- To: mathgroup at smc.vnet.net
- Subject: [mg63582] Re: Best linear Fit to slope data with Fixed starting point/value.
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 6 Jan 2006 05:24:24 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 1/5/06 at 3:12 AM, readnewsciv at earthlink.net (Bill Rowe) wrote: >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] This should have been FindFit[data -First[data], m*(x-1), m, x] >In[3]:=model = m*x + First[data] /. % And this should have been model = m*(x-1) + First[data]/.% Mathematica starts its indexing at 1 which requires x-1 to be used as the basis rather than x to get a model that is forced through the origin. -- To reply via email subtract one hundred and four