# Weightening and fitting

Thu, 07/15/2021 - 10:28 am

Hello,

It’s the first time I use Igor software and I have some doubts about curve fitting.

I have 12 datapoints in triplicate that I got by an FP assay. I calculated average values and standard deviation by using excel spreadsheet.

I used Igor in two ways and I don’t know if they are correct.

1) I loaded x values, average values and standard deviation in a table. I plotted average data vs x values, I modified the points by adding error bars and selecting the column containing my standard deviations as source of positive y and negative y for error bars. Then I fitted by Hill-curve but I did not selected nothing in “weighting”. I got an xhalf = 210 +- 99 and a V_chisq ⁓ 10E-06

2) I did the same things but I did not select “none” as weighting, I selected the column with my standard deviations and barred the “standard deviation” box. I got xhalf= 153.2 +- 119 and Vchisq = 2.44072.

I did not well understand the meaning of weighting and Vchisq. I would think the first way is better (and so I shouldn’t have had to weight the fitting ) if Vchisq was chi square.

I hope you can help me and I thank you in advance,

Gabriele

I'm not completely understanding your treatment of the data. Would you be willing to post your Igor experiment file so we can examine it directly?

July 15, 2021 at 11:14 am - Permalink

I also do not fully understand what the problem is. What is your goal? If you just want to know what Vchisq is, then, yes, it represents the chi^2 value. As far as I understand it, you need to provide a proper weighting to get a meaningful chi^2 output, and the weighting should be given as the standard deviation of each data value. So I would think your second approach is the one you are looking for. You may want to read the relevant section in the manual:

`DisplayHelpTopic "Weighting"`

July 15, 2021 at 07:19 pm - Permalink

Perhaps you are asking why the unweighted fit gives a smaller relative uncertainty in the value compared to the weighted fit. The reason is that, when you weight the values of the data points, you are forcing the fit curve to take a different path through the data points. In the unweighted case, the curve treats all points as equal. The path will optimize a global minimum. Points that may fall close to a global minimum will "pull" the curve more closely. In the case of weighted fitting, the "pull" that a data point has is proportional to its weighting. The path will be different. You can see this by doing this

* Fit with an unweighted fit while showing the fit curve on the graph

* Rename the fit wave

* Fit with a weighted fit while showing the fit curve on the graph

--> The weighted fit wave will not have the same path as the unweighted fit wave

As long as you trust the standard deviations of the (three) multiple measurements to be true representations of the standard uncertainty of the randomness of your measurement methods, you should always prefer a weighted fit over an unweighted fit. Three measurements is considered a small (very small) sample size in the scheme of curve fitting. Who is to say that you do not have one case where your three measurements are skewed by what otherwise would be found to be an outlier for that specific measurement condition. How confident are you that three measurements are enough?

In summary, the fact that chi is smaller for the first case than for the last suggests that, by weighting the data points, you have placed full confidence in the standard uncertainty of the data points being a true representation of the standard deviation obtained by doing an infinite number. Your weighted fitting of the model cannot support telling you that you have a high confidence in the overall fitting coefficient AND that all measured data points are appropriately weighted (the standard uncertainty is a true measure of the standard deviation of the data at each condition). If you want to improve the result, you are likely going to have to do one of two things (or both):

* Take more measurements at each condition (at least five measurements if not more)

* Live with the higher uncertainty from the weighted fit as a truer representation of the overall uncertainty of both your measurement processes (too few measurements) and your model

July 17, 2021 at 07:36 am - Permalink

In reply to Perhaps you are asking why… by jjweimer

V_Chisq itself is weighted, so while the weighted fit may indeed take a different path, it is not just the path that affects V_chisq (in this case by six orders of magnitude).

July 18, 2021 at 01:37 am - Permalink

Yes. Thanks Tony. I was also hoping to address any concerns that OP might have about why the relative uncertainty on the fitting coefficient increases from about 50% to about 80% in going from unweighted fitting to weighted fitting.

July 18, 2021 at 06:55 am - Permalink

In reply to Perhaps you are asking why… by jjweimer

I thank you for helping me and for your time.

I did not think about these concerns. Unfortunately, I can't do more measurements because I came to the end of my traineeship period.

Do you think it's better I take in consideration unweighted fitting rather than weighted fitting ( by standard deviation)?

Besides, after a careful reading of Igor manual, I tried to weight by using of the standard error rather than standard deviation and I noticed that relative uncertainty decreased (Kd = 153.2 +- 68.6) even if V_chisq was a bit higher (7.3). I noticed this situation in other FP curve and I think this fitting way is better than others but I'm plenty of uncertainties about this field.

I would be pleased if you could give me an opinion about that.

July 19, 2021 at 09:08 am - Permalink

Another effect of weighting is that Igor uses your weights as the "real" uncertainty when computing the coefficient errors, trusting that you have a good estimate and that you are honest. Without weighting, the residuals are taken as representing the distribution of measurement errors on the assumption that your measurements across all data points have the same gaussian distribution.

Which brings up a good point- are the measurement errors actually different amongst your 12 points? Averaging three points and using either the standard deviation or standard error is suspect because of the extremely small sample size. If all measurements represent samples from the same Gaussian distribution, you may be better off fitting the un-averaged data (36 measurement, right?) and letting Igor do the estimating.

Without weighting, though, the chi-square value is not useful for testing goodness of fit.

July 19, 2021 at 11:07 am - Permalink

I should say, as I usually do in situations like this, that you might need to ask a real statistician. I have learned a lot about curve fitting over my years with WaveMetrics, but I would not say I'm an expert statistician.

July 19, 2021 at 11:09 am - Permalink

John's cautions are good. The better approach may indeed be to fit all 3 x 12 = 36 data points with an unweighted approach. I expect that your report is not going to be concerned about the chi-squared value from the fit as much as it will be concerned with robustly reporting a) the approach taken to fit the data and b) the fitting coefficient AND its standard uncertainty.

July 19, 2021 at 02:39 pm - Permalink