MathGroup Archive 2005

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

Search the Archive

Re: How to show level of accuracy from original data FROM Re: Coefficients from Fit as a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg63442] Re: How to show level of accuracy from original data FROM Re: [mg63396] Coefficients from Fit as a list?
  • From: "Lea Rebanks" <lrebanks at netvigator.com>
  • Date: Sat, 31 Dec 2005 06:40:45 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Really helpful.  Many thanks Bob.  

-----Original Message-----
From: Bob Hanlon [mailto:hanlonr at cox.net] 
To: mathgroup at smc.vnet.net
Subject: [mg63442] Re: How to show level of accuracy from original data FROM Re:
[mg63396] Coefficients from Fit as a list?

points={{0,-1},{1,2},{3,7},{4,6},{7,9},{11,14}};

model=a*x^2+b*x+c;
param={a,b,c};
var=x;

f[x_]=model/.FindFit[points,model,param,var];

SumOfSq=Total[(f/@points[[All,1]]-points[[All,2]])^2]

6.72994

or

MSE=Mean[(f/@points[[All,1]]-points[[All,2]])^2]

1.12166


Bob Hanlon

> 
> From: "Lea Rebanks" <lrebanks at onetelhk.net>
To: mathgroup at smc.vnet.net
> Subject: [mg63442] How to show level of accuracy from original data  FROM  Re: 
[mg63396] Coefficients from Fit as a list?
> 
> Hi Bob,
> 
> When using FindFit to give the best linear approximation to data set
> points. Could you show me a simple example of code / function to show
> level of accuracy / error deviation from original data set.
> 
> Many thanks
> 
> Lea Rebanks...
> 
> -----Original Message-----
> From: Bob Hanlon [mailto:hanlonr at cox.net] 
To: mathgroup at smc.vnet.net
> Subject: [mg63442] [mg63414] Re: [mg63396] Coefficients from Fit as a list?
> 
> points={{0,-1},{1,2},{3,7},{4,6},{7,9},{11,14}};
> 
> Fit[points,{1,x,x^2},x]
> 
> -0.0592841*x^2 + 1.89613*x - 0.113262
> 
> Reverse@Most@Cases[%,_?NumericQ,Infinity]
> 
> {-0.0592841,1.89613,-0.113262}
> 
> param={a,b,c};
> 
> param/.FindFit[points,a*x^2+b*x+c,param,x]
> 
> {-0.0592841,1.89613,-0.113262}
> 
> Needs["Statistics`NonlinearFit`"];
> 
> param/.(BestFitParameters/.
>       NonlinearRegress[points,
>          a*x^2+b*x+c, x, param])
> 
> {-0.0592841,1.89613,-0.113262}
> 
> 
> Bob Hanlon
> 
> > 
> > From: "LectorZ" <lectorz at mail.ru>
To: mathgroup at smc.vnet.net
> > Date: 2005/12/29 Thu AM 02:57:28 EST
> > Subject: [mg63442] [mg63414] [mg63396] Coefficients from Fit as a list?
> > 
> > Hi there,
> > 
> > How can I store the coefficients from the Fit function as a list?
> > 
> > Thanks,
> > 
> > LZ
> > 
> > 
> 
> 
> 
> 




  • Prev by Date: Re: Mathematica Programmer vs. Programming in Mathematica/ functions and OOP
  • Next by Date: Re: Re: Taking either a sequence or a list
  • Previous by thread: Re: How to show level of accuracy from original data FROM Re: Coefficients from Fit as a list?
  • Next by thread: How to specify these limits in an integral?