Creating Computer Code
In creating a computer code you must consider a few things:
This first is, you must be able to judge "high" and "low" values of . This is called the "reduced " value, or normalized by the number of degrees of freedom. The minimum value of then would be equal to 1. Thus, fits which result in a reduced near (but greater than) 1 would be acceptable. Fits with reduced values less than 1 are not real; fits with reduced much greater than 1 are poor fits and another equation is required.
The next consideration is the reduced equation.
rchisq = sum((yyfit)**2/sigma**2/nfree
where y is the array of data points, sigma is the array of standard deviations for the data points, nfree is the number of degrees of freedom. And yfit is the fitted values of the data. Note that the number of degrees of freedom is equal to Nn1, where N is the number of data points fit by (n+1) parameters.
For more information, you may want to consult the book Data Reduction and Error Analysis for the Physical Sciences, written by Philip R. Bevington and D. Keith Robinson.
