Chi-Square and reduced chi-square

I have a problem understanding the chi-square that is given by igor fit. I know that if we don't use the weighting wave, the V_chisq don't have any absolute meaning. But after using the weighting wave, what is the V-Chisq telling us? Is it the reduced chi-square value or we have to calculate using that V_Chisq value and divide by degrees of freedom to get reduced chi-square? Also how do I calculate degrees of freedom? The equation that I am trying to fit has four parameters and the experimental data points that I am using has 94 points.
Moreover, sometimes I am holding one parameter constant to some value to get the fit. how would that change the degrees of freedom.

TO BE MORE SPECIFIC to the situation;

I am averaging 12 points to get one point; and basically have 94 points each obtained from 12 point average. Then i have calculated the std. deviation for each point. Then i divided those std. deviation with the square root of 12 (i.e no. of points used to get each point) to get the std. error. And i am not sure if i am doing right to get the std. error. Can somebody help me to explain these issue? I will appreciate you help very much. I hope I am not overwhelming with too much information. Thanks.
When you use a weighting wave, chi-square is computed using the weighted residuals:

chi-square = ((Yi - Yihat)/wi)^2
Here, Yi refers to your input data, Yihat refers to the corresponding model values, and wi refers to the corresponding weight values.

If your estimate of the weight is correct, then the chi-square should be roughly equal to the number of data points. It is common to report instead the value divided by N or N-1, but Igor doesn't do that.

If your 94 points are the result of averaging (that is, you start out with 12*94 points) then you are correct, DF = 94-4 when you have 4 fit coefficients. If you hold one fit coefficient constant during the fit, then it does not contribute. Then DF = 94-3. If that difference is important to you, you are reading too much into the statistics :)

It looks like you are computing the standard error of the mean correctly.

Note that all of this discussion implies the assumption that the measurement errors have a Normal distribution with zero mean, and that the fit is linear in the coefficients. If you are fitting a nonlinear function, even with normally distributed errors the statistics are approximations only. That means that error reports are approximations of estimations! If your fit function is not too nonlinear the approximation is often quite good, but you need to be aware of this issue.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
Thanks for the reply. It helped me a lot.

I have one more question.

The fit I am doing is for FRAP analysis. The equation is F(t)= [{F0 + F∞(t/t1/2)}^α]/[1+(t/t1/2)^α]. The t1/2 "is time half". So I have four parameters F0, F∞, t1/2 and α. This equation is I believe non-linear, right?

Moreover, I read the analysis of the FRAP curve written for Igor 6 by Author: Kota Miura.
It has also mentioned that

"Using chi-square obtained by equation, chi-square distribution for N-M degree of freedom can be calculated using incomplete gamma function. Then this distribution gives the probability Q that the chi-squared should exceed a particular chi-square by chance"

I saw the function syntax in Igor ver 6.12 for incomplete gamma function which looks like " gammaInc (a, x [ , upperTail]) ". But I am not sure how to use that function in Igor to calculate the probability q distribution in my case. Would you guide me in this case?

Thanks for your assistance. I am starting to love Igor everyday. I am so glad when I found that we could use this forum to exchange the difficulties we are having.
Dipak Mainali wrote:
The fit I am doing is for FRAP analysis. The equation is F(t)= [{F0 + F∞(t/t1/2)}^α]/[1+(t/t1/2)^α]. The t1/2 "is time half". So I have four parameters F0, F∞, t1/2 and α. This equation is I believe non-linear, right?

Yes, it is.
Quote:
Moreover, I read the analysis of the FRAP curve written for Igor 6 by Author: Kota Miura.
It has also mentioned that

"Using chi-square obtained by equation, chi-square distribution for N-M degree of freedom can be calculated using incomplete gamma function. Then this distribution gives the probability Q that the chi-squared should exceed a particular chi-square by chance"

I saw the function syntax in Igor ver 6.12 for incomplete gamma function which looks like " gammaInc (a, x [ , upperTail]) ". But I am not sure how to use that function in Igor to calculate the probability q distribution in my case. Would you guide me in this case?

In Igor, you could execute a command like this:
print gammq(DF/2, V_chisq/2)
Subsitute for "DF" the degrees of freedom from your fit.
Quote:
Thanks for your assistance. I am starting to love Igor everyday. I am so glad when I found that we could use this forum to exchange the difficulties we are having.

Thank you for your kind words.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
I am getting value 1 when I entered the Print gammaq(DF/2, V_chisq/2) regardless of what degrees of freedom I enter or what V_chisq I enter or if I keep the V_chisq as it is. Am I missing anything before entering that command? Thanks for your help.
Can you post an Igor experiment file that I can look at?

If I execute these commands:
make/N=10 junk=p+gnoise(1)
display junk
CurveFit/M=2/W=0 line, junk/D
print gammq(4, V_chisq/2)       // 4 is 8/2; 8 is 10 points - 2 coefficients for a line fit

I get various values depending on the exact noise added by gnoise, but generally between about 0.5 and 0.9. What do you get?

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
For 90 degrees of freedom, I get value of 1 for the values of V-chisq less than 39 value and get different numbers for higher V_chisq i.e greater than 40, which are usually less than 1. And gets dramatically reduce to lower values 0.0005 for V_Chisq 140.
I have attached the igor experiment.

Just in case if igor doesn't open, I have added the history report below


•Display/L=Res_Left Pool14 vs Time76
•Make/D/N=4/O W_coef
•W_coef[0] = {0.51,0.81,10,1}
•Make/O/T/N=4 T_Constraints
•T_Constraints[0] = {"K0 > 0","K1 > 0","K2 > 0","K3 > 0"}
•FuncFit/NTHR=0/TBOX=768 anom_dif W_coef Pool14[5,98] /X=Time76 /W=Stderr14 /I=1 /D /C=T_Constraints
Fit converged properly
--Curve fit with constraints--
No constraints active or violated
Curve fit with data subrange:
Pool14[5,98]
fit_Pool14= anom_dif(W_coef,x)
W_coef={0.48114,0.81779,5.6143,0.71463}
V_chisq= 8.83914;V_npnts= 94;V_numNaNs= 0;V_numINFs= 0;
V_startRow= 5;V_endRow= 98;
W_sigma={0.014,0.0169,0.925,0.0917}
Coefficient values ± one standard deviation
Fo =0.48114 ± 0.014
Fin =0.81779 ± 0.0169
t12 =5.6143 ± 0.925
al =0.71463 ± 0.0917
•Print gammq(90/2, V_chisq/2)
1


What are those gnoise and do I need to worry about that in data fitting?

Again, I appreciate your help. I am getting closer to the final conclusion of my data fit. Thanks and have a good weekend.
IgorExchange.pxp (0 bytes)
gnoise() is an Igor function that creates pseudo-random gaussian deviates. That is, it just adds fake measurement error. Since we know exactly what the measurement error distribution is (because we used gnoise()), it is easier to interpret the result of the fit. That makes it convenient for an example, or for learning about the operations.
Quote:
Just in case if igor doesn't open, I have added the history report below

In fact, I can open the experiment but I can't run it because it lacks the procedure file "Calc".
Quote:
And gets dramatically reduce to lower values 0.0005 for V_Chisq 140.

What is meant by the phrase, "Then this distribution gives the probability Q that the chi-squared should exceed a particular chi-square by chance" is that the weighting wave tells FuncFit to expect a certain level of measurement error. V_chisq is an estimate of the measurement error, and if V_chisq is much larger than expected, it indicates that the model doesn't fit the data well (or that you are overly optimistic in your error estimate, or that the model is too nonlinear). So I think your result is consistent with that- large V_chisq results in low probability that the fit could be that bad by chance- it means the model doesn't fit the data well. The probability of 1 clearly can't really happen, but it may be so close to 1 that roundoff errors make it appear to be 1. That would happen if your are pessimistic about the measurement errors, or if the model is too nonlinear, or by chance the actual errors were small compared to what is expected.

Your fit looks really good, and the measurement errors appear to be pretty small. My guess is nonlinearity- your FRAP model you wrote out in an earlier post has those pesky exponents and such. You might want to investigate these questions using some sort of Monte Carlo technique.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
johnweeks wrote:

Your fit looks really good, and the measurement errors appear to be pretty small. My guess is nonlinearity- your FRAP model you wrote out in an earlier post has those pesky exponents and such. You might want to investigate these questions using some sort of Monte Carlo technique.


The gencurvefit XOP has some code in it to investigate parameter uncertainties with Monte Carlo techniques.