comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » chisq value
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: chisq value [message #85874 is a reply to message #85872] Sun, 15 September 2013 23:16 Go to previous messageGo to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
On 2013-09-16 07:11, sid wrote:
> Hello everyone,
> I am trying to understand what is the chisq keyword means in the routine,
> poly_fit,
> svdfit
> linfit
>
> So I took a simple example, x=[1,2,3,4],y=[1,2,3,4]
> when I give
> p=poly_fit(x,y,1,chisq=c)
> c= 1.14631e-30
> p=svdfit(x,y,2,chisq=c)
> c= 2.86139e-13
> p=linfit(x,y,chisqr=c)
> c=0.00000
>
> for poly_fit and linfit the definition of chisq is the same
> "Set this keyword to a named variable that will contain the value of the unreduced chi-square goodness-of-fit statistic"
>
> But the chisq values are different in both these cases even though the inputvalues given are same.

You example data makes a "prefect" fit, so the chisq values are mostly
numerical precision errors. If you choose data that do not fit perfectly
to a straight line, the results make more sense:

IDL> x=[1,2,3,4]
IDL> y=[1.1,2.0,3.3,3.9]
IDL> p=poly_fit(x,y,1,chisq=c)
IDL> print,c
0.0830000
IDL> p=svdfit(x,y,2,chisq=c)
IDL> print,c
0.0830001
IDL> p=linfit(x,y,chisqr=c)
IDL> print,c
0.0829998


> Could anyone please let me know what this chisq fit actually means.

Try this:

IDL> p=linfit(x,y,chisqr=c,yfit=yfit)
IDL> print,yfit
1.12000 2.09000 3.06000 4.03000
IDL> print,total((y-yfit)^2)
0.0829998
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: RTV_DOIT to EVF
Next Topic: IDL X11 forwarding segmentation fault

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:12:35 PDT 2025

Total time taken to generate the page: 0.00500 seconds