The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Chi sqaure problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

a.abc.b35

175 Posts

Posted - 09/12/2011 :  12:16:48 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.1
Operating System:win 7
In any fit, we can get the value of red. chi sq. which origin calculates by itself. I am aware of this thread (http://www.originlab.com/forum/topic.asp?TOPIC_ID=4058) and what Deepak says there is absolutely correct. I have one question after I played with my data which I narrate below:
My data is in X-Y column which follows normal distribution. I try NLFIT on it (say Gaussian/ normal distribution). I shall get a value of Red. chi sq. in origin which is very small and ideally I would expect it to be close to 1 if the FIT is good (as is my case). BUT THAT DOES NOT HAPPEN!!!!!! Next, what I do is, I multiply all my Y values by say, 100 and repeat the fitting again. As the distribution is same, I expect to get the same Red. chi sq. value. But what I get is 2 orders of magnitude higher than the previous value of Red. chi sq.!!!!!!!! Ain't this strange ? I am sure there is some problem in the method of calculating Red. chi sq.!!! Can someone please explain it.


PS: Multiplying by a constant should not change the value of one of the goodness of fit parameters (which is Red. chi sq. here). I look forward to a good answer for this one. AND I DO HAVE A COPY OF BEVINGTON WITH ME..

AB

a.abc.b35

175 Posts

Posted - 09/12/2011 :  12:29:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
JUST TO ADD: I have used statistical method of weighing in calculating the errors, RSS, and Red. chi sq.

AB
Go to Top of Page

a.abc.b35

175 Posts

Posted - 09/12/2011 :  12:59:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Also, I have checked using the linear model (y = a + b*x, for the data (of Bevington) in the thread I mention in my 1st post). By following the same procedure (using NLFIT window and going to the equation), I get the same result. BUT THAT IS ACTUALLY A LINEAR FIT. AND I AM KIND OF GUESSING THAT ORIGIN'S CALCUALTION OF Red. Chi Sq. has some serious flaws when it comes to nonlinear fitting ! I shall be happy to be proven wrong!

AB
Go to Top of Page

Sam Fang

293 Posts

Posted - 09/13/2011 :  02:12:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for your information.

You should use "Instrumental" or "Variance ~ y^2" instead of "Statistical" because "Statistical" use y as variance, not y^2. In fact when you multiply y by 100, the variance will be multiplied by 100^2, not 100 from its definition.

Origin uses the same formula to calculate reduced chi-sqr as the wiki:
http://en.wikipedia.org/wiki/Goodness_of_fit

I used Origin's built-in data "Gaussian.dat" and multiplied data by 100 with "Variance ~ y^2" weighing method for NLFit, reduced chi-sqr is same for two cases.

If your reduced chi-sqr is too small, you should check whether the variance has been over-estimated first.

Note that reduced chi-sqr has absolute meaning for a measure of the goodness of fit only if a weighing containing the reciprocal of the variance for each point.

Sam
OriginLab Technical Services

Edited by - Sam Fang on 09/13/2011 02:24:27 AM
Go to Top of Page

a.abc.b35

175 Posts

Posted - 09/13/2011 :  6:55:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
@ Sam,
Try fitting the same data with both Statistical and instrumental weighing method, and you'll get Red. Chi sq as 1.09 and R^2 = 0.94. Obviously the fit is a better one when you compare with variance method (like you did) where you get the values as 0.19 and 0.64 respectively.
So what you are saying is not necessarily true, though I am still trying to understand the meaning of your last line. Now, I give one dataset here: Please try on this and let me know.
............
X Y Error
-2.08 4.03 2.01
-2.04 4.04 2.01
-2.01 4.04 2.01
-1.97 4.06 2.01
-1.94 4.01 2
-1.9 4.03 2.01
-1.87 4.08 2.02
-1.83 4.08 2.02
-1.8 4.08 2.02
-1.76 4.13 2.03
-1.73 4.16 2.04
-1.69 4.17 2.04
-1.66 4.21 2.05
-1.62 4.26 2.06
-1.59 4.28 2.07
-1.55 4.32 2.08
-1.52 4.38 2.09
-1.48 4.45 2.11
-1.45 4.49 2.12
-1.41 4.56 2.13
-1.38 4.64 2.15
-1.34 4.7 2.17
-1.31 4.81 2.19
-1.27 4.88 2.21
-1.24 4.97 2.23
-1.2 5.12 2.26
-1.17 5.23 2.29
-1.13 5.36 2.32
-1.1 5.47 2.34
-1.06 5.63 2.37
-1.03 5.74 2.4
-0.99 5.95 2.44
-0.96 6.12 2.47
-0.93 6.28 2.51
-0.89 6.46 2.54
-0.86 6.6 2.57
-0.82 6.81 2.61
-0.79 7.03 2.65
-0.75 7.22 2.69
-0.72 7.41 2.72
-0.68 7.53 2.74
-0.65 7.6 2.76
-0.61 7.74 2.78
-0.58 7.83 2.8
-0.54 7.98 2.83
-0.51 8.07 2.84
-0.47 8.05 2.84
-0.44 8.12 2.85
-0.4 8.09 2.84
-0.37 8.08 2.84
-0.33 7.97 2.82
-0.3 7.9 2.81
-0.26 7.75 2.78
-0.23 7.63 2.76
-0.19 7.44 2.73
-0.16 7.3 2.7
-0.12 7.11 2.67
-0.09 6.97 2.64
-0.05 6.75 2.6
-0.02 6.59 2.57
0.02 6.37 2.52
0.05 6.23 2.5
0.09 6.06 2.46
0.12 5.93 2.43
0.16 5.8 2.41
0.19 5.64 2.37
0.23 5.54 2.35
0.26 5.4 2.32
0.3 5.29 2.3
0.33 5.18 2.28
0.37 5.08 2.25
0.4 5 2.24
0.44 4.93 2.22
0.47 4.85 2.2
0.51 4.8 2.19
0.54 4.71 2.17
0.58 4.67 2.16
0.61 4.61 2.15
0.65 4.61 2.15
0.68 4.55 2.13
0.72 4.52 2.13
0.75 4.45 2.11
0.79 4.45 2.11
0.82 4.41 2.1
0.86 4.42 2.1
0.89 4.4 2.1
0.93 4.38 2.09
0.96 4.36 2.09
0.99 4.35 2.09
1.03 4.35 2.09

AB
Go to Top of Page

a.abc.b35

175 Posts

Posted - 09/13/2011 :  9:43:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Or , for example, take the data below (pure Gaussian):
X Y
-2.07694163534033 0.00542471909698161
-2.04203522483337 0.00716336778385607
-2.00712863979348 0.00940239706886725
-1.97222205475359 0.0122670647946848
-1.93731546971371 0.0159082886984789
-1.90240888467382 0.0205062855931564
-1.86750229963393 0.0262743071397393
-1.83259571459405 0.0334623375919474
-1.79768912955416 0.0423605912801577
-1.76278254451427 0.0533026110578829
-1.72787595947439 0.0666677329433076
-1.69296951406084 0.0828825779192197
-1.65806292902095 0.102421688368516
-1.62315634398107 0.125805997018486
-1.58824975894118 0.15360009709726
-1.55334317390129 0.186407065518233
-1.51843658886141 0.224860919524621
-1.48353000382152 0.26961641393602
-1.44862341878163 0.321336017454938
-1.41371683374175 0.380674002878568
-1.37881024870186 0.448257705671806
-1.34390378583502 0.524665862325487
-1.30899720079513 0.610406048003462
-1.27409061575525 0.705887646754221
-1.23918403071536 0.811396384974073
-1.20427744567548 0.927067354798846
-1.16937086063559 1.05285906663589
-1.1344642755957 1.18852939573303
-1.09955776036899 1.33361431760083
-1.0646511753291 1.48741243197109
-1.02974459028921 1.64897206287657
-0.994838005249326 1.81708783851925
-0.959931420209439 1.99030337183295
-0.925024904982723 2.16692209400942
-0.890118319942836 2.34502850528692
-0.855211734902949 2.52251459589239
-0.820305149863063 2.69711821859291
-0.785398564823176 2.86646742355043
-0.75049204959646 3.02813146901473
-0.715585464556573 3.17967861414989
-0.680678879516687 3.31873410532925
-0.6457722944768 3.44304282126614
-0.610865709436913 3.55052947925421
-0.575959194210197 3.6393559645628
-0.54105260917031 3.70797422134249
-0.506146024130424 3.75517005938249
-0.471239439090537 3.7800996268175
-0.436332871503943 3.78231431358999
-0.401426286464056 3.76177417236782
-0.366519736330755 3.71884916440391
-0.331613151290868 3.65430790006633
-0.296706566250982 3.56929499400046
-0.26180001611768 3.46529726843808
-0.226893448531086 3.34410018270828
-0.1919868634912 3.20773726132391
-0.157080297649935 3.05843351116998
-0.122173730063341 2.89854490518954
-0.0872671624767465 2.73049734216116
-0.0523605896541647 2.5567261567718
-0.0174540168315829 2.37961887966287
0.017452555990999 2.2014627038699
0.0523591288135808 2.02439843799633
0.0872656964001749 1.85038200322232
0.122172274458744 1.68115408803624
0.157078833318692 1.51821894140051
0.19198541486792 1.36283097406935
0.226891982454514 1.21599094141312
0.261798550041108 1.07844852179647
0.296705135080995 0.95071250659016
0.331611685214297 0.833066722248953
0.366518270254183 0.725589589338126
0.401424837840777 0.628178494572913
0.436331422880664 0.540574790199127
0.47123800792055 0.462390864999385
0.506144558053852 0.393136627347874
0.541051143093739 0.332244984473816
0.575957728133625 0.279096308799648
0.610864243360342 0.233040092644869
0.645770828400228 0.193413941311296
0.680677413440115 0.15956059188821
0.715583998480001 0.130841114727987
0.750490583519888 0.106645753123753
0.785397098746605 0.0864020037109681
0.820303683786491 0.0695800306353078
0.855210268826378 0.0556962749974028
0.890116853866264 0.0443147616744159
0.925023438906151 0.0350470460231422
0.959929954132868 0.0275508729818883
0.994836539172754 0.0215278092628797
1.02974312421264 0.0167203376147631

AB
Go to Top of Page

Sam Fang

293 Posts

Posted - 09/14/2011 :  07:40:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi AB,

Thanks for your data.

Results of Statistical and instrumental weighing method are same because the standard deviation of the data is sqrt(y), and variance from Statistical and instrumental are same in this case.

From the page (http://www.sprawls.org/ppmi2/STATS/), radiation events (such as count values) are distributed in a very special way, The error range, expressed as a percentage of the measured value, decreases as the number of counts in an individual measurement is increased. And its standard deviation=sqrt(measured value).

I don't know whether radiation events can use reduced chisq to interpret its fitting result, since chi-square distribution requires (y-yi)/sigma(i) are independent, standard normal random variables. As we all know, for a general random variable X with standard deviation s, then the standard deviation for nX is ns. If this rule is followed, when data is multiplied by n, corresponding deviations are also multiplied by n, then reduced chisq will not change. However it seems that radiation events don't follow this rule.

Sam
OriginLab Technical Services
Go to Top of Page

Sam Fang

293 Posts

Posted - 09/15/2011 :  04:07:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi AB,

Standard deviation for count values is sqrt(y) because Poisson distribution is assumed for y, this is true for most count value from radiation events. However y follows Poisson distribution, you can't say ny also follows Poisson distribution. You can notice Poisson number can be 1,2,.., but nY can only be n,2n,... So if you multiply count values of Poisson number by a factor, they may not follow Poisson distribution now. And its standard deviation is not sqrt(ny).

Reduced chisq for your first data is very small because your y data don't follow Poisson distribution. Poisson distribution should be count values not double. If it is not from Poisson distribution, its standard deviation can't use sqrt(y).

In fact you can perform Normality Test using your fitting result (y-yi)/sigma(i) for your first data, the P-value is 0.059 and Standard deviation is 0.05, it deviates from standard normal distribution which chisq is required. You can also compare Origin's built-in data Gaussian.dat.

Sam
OriginLab Technical Services
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000